@@ -23,7 +23,7 @@
|
|||||||
# if not a new bug issue will be generated.
|
# if not a new bug issue will be generated.
|
||||||
class ExceptionhandlerController < ApplicationController
|
class ExceptionhandlerController < ApplicationController
|
||||||
unloadable
|
unloadable
|
||||||
|
|
||||||
helper :exceptionhandler
|
helper :exceptionhandler
|
||||||
include ExceptionhandlerHelper
|
include ExceptionhandlerHelper
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ class ExceptionhandlerController < ApplicationController
|
|||||||
if params.size != 2
|
if params.size != 2
|
||||||
flash.now[:alert] = "Not enough args"
|
flash.now[:alert] = "Not enough args"
|
||||||
end
|
end
|
||||||
|
|
||||||
# check to see if the reported project exists
|
# check to see if the reported project exists
|
||||||
elsif Project.find_by_name(params[:app]) == nil
|
elsif Project.find_by_name(params[:app]) == nil
|
||||||
flash.now[:error] = "Project Not Found"
|
flash.now[:error] = "Project Not Found"
|
||||||
@@ -42,6 +42,10 @@ class ExceptionhandlerController < ApplicationController
|
|||||||
|
|
||||||
else
|
else
|
||||||
#if we get to this point, then we can try file the incomming report
|
#if we get to this point, then we can try file the incomming report
|
||||||
|
|
||||||
|
#lets deobfuscate the traces
|
||||||
|
params[:stackTrace] = deobfuscate(params[:stackTrace], params[:package], params[:version])
|
||||||
|
params[:cause] = deobfuscate(params[:cause], params[:package], params[:version])
|
||||||
|
|
||||||
#check to see if the report exists
|
#check to see if the report exists
|
||||||
# if we get a report back, then let update it
|
# if we get a report back, then let update it
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# exceptionhandler_helper.rb
|
# exceptionhandler_helper.rb
|
||||||
# @date Feb. 15, 2012
|
# @date Feb. 15, 2012
|
||||||
# @author ricky barrette <rickbarrette@gmail.com>
|
# @author ricky barrette <rickbarrette@gmail.com>
|
||||||
# @authro twenty codes <twentycodes@gmail.com>
|
# @author twenty codes <twentycodes@gmail.com>
|
||||||
#
|
#
|
||||||
# Copyright 2012 Rick Barrette
|
# Copyright 2012 Rick Barrette
|
||||||
#
|
#
|
||||||
@@ -18,8 +18,10 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
module ExceptionhandlerHelper
|
module ExceptionhandlerHelper
|
||||||
|
|
||||||
|
require 'tempfile'
|
||||||
|
|
||||||
# Checks the database for exisiting reports
|
# Checks the database for existing reports
|
||||||
# @return existing issue report if existing
|
# @return existing issue report if existing
|
||||||
def check_for_existing_report
|
def check_for_existing_report
|
||||||
bug_id = tracker.id
|
bug_id = tracker.id
|
||||||
@@ -34,8 +36,8 @@ module ExceptionhandlerHelper
|
|||||||
return nil;
|
return nil;
|
||||||
end
|
end
|
||||||
|
|
||||||
# checks a specific issue agains params
|
# checks a specific issue against parameters
|
||||||
# @return true if the suppyled issue matches new report args
|
# @return true if the supplied issue matches new report args
|
||||||
def check_issue(issue)
|
def check_issue(issue)
|
||||||
if issue.subject == params[:msg]
|
if issue.subject == params[:msg]
|
||||||
if check_issue_custom_values(issue)
|
if check_issue_custom_values(issue)
|
||||||
@@ -111,8 +113,8 @@ module ExceptionhandlerHelper
|
|||||||
return custom_value
|
return custom_value
|
||||||
end
|
end
|
||||||
|
|
||||||
# updates the provided issue with the incomming report
|
# updates the provided issue with the incoming report
|
||||||
# @returns true if save is sucessful
|
# @returns true if save is successful
|
||||||
def update_report(issue)
|
def update_report(issue)
|
||||||
if params[:description].length > 0
|
if params[:description].length > 0
|
||||||
description = issue.description
|
description = issue.description
|
||||||
@@ -139,8 +141,8 @@ module ExceptionhandlerHelper
|
|||||||
return issue.save
|
return issue.save
|
||||||
end
|
end
|
||||||
|
|
||||||
# gets the prodived tracker
|
# gets the provided tracker
|
||||||
# if it doesnt exist, defualt to Bug
|
# if it doesn't exist, default to Bug
|
||||||
def tracker
|
def tracker
|
||||||
if(params[:tracker]!= nil)
|
if(params[:tracker]!= nil)
|
||||||
if params[:tracker].length > 0
|
if params[:tracker].length > 0
|
||||||
@@ -152,5 +154,35 @@ module ExceptionhandlerHelper
|
|||||||
end
|
end
|
||||||
return Tracker.find_by_name("Bug")
|
return Tracker.find_by_name("Bug")
|
||||||
end
|
end
|
||||||
|
|
||||||
end #EOF
|
# de obfuscates a trace of there is a map available
|
||||||
|
def deobfuscate (stacktrace, package, build)
|
||||||
|
|
||||||
|
map = Map.find_by_package(package)
|
||||||
|
|
||||||
|
if map != nil
|
||||||
|
map = map.find_by_build(build)
|
||||||
|
end
|
||||||
|
|
||||||
|
if map != nil
|
||||||
|
|
||||||
|
# Save the stack trace to a temp file
|
||||||
|
# might need to add ruby path
|
||||||
|
tf = Tempfile.open('stacktrace')
|
||||||
|
tf.puts stacktrace
|
||||||
|
|
||||||
|
#retrace
|
||||||
|
Dir.chdir("#{RAILS_ROOT}/vendor/plugins/redmine-exception-handler/public/proguard") do
|
||||||
|
Open3.popen3("bin/retrace.sh #{RAILS_ROOT}/public/maps/#{map} #{RAILS_ROOT}/#{tf.path}") do |stdrin, stdout, stderr|
|
||||||
|
output = stderr.read
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
tf.close!
|
||||||
|
retrun output
|
||||||
|
else
|
||||||
|
return stacktrace
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|||||||
@@ -14,4 +14,6 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<%= params.inspect %>
|
<%= params.inspect %>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
<%= @output %>
|
<%= @output %>
|
||||||
|
|||||||
@@ -9,4 +9,4 @@
|
|||||||
|
|
||||||
PROGUARD_HOME=`dirname "$0"`/..
|
PROGUARD_HOME=`dirname "$0"`/..
|
||||||
|
|
||||||
java -jar $PROGUARD_HOME/lib/retrace.jar "$@"
|
/opt/java/jre/bin/java -jar $PROGUARD_HOME/lib/retrace.jar "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user