Class: Tracetool::Android::JavaTraceScanner
- Inherits:
-
Object
- Object
- Tracetool::Android::JavaTraceScanner
- Defined in:
- lib/tracetool/android/java.rb
Overview
Processes java traces
Constant Summary collapse
- RX_FIRST_EXCEPTION_LINE =
Usually java trace starts with
com.something.SomeClass(: Some message)?
/^([a-zA-Z.]*)(:.*)?$/.freeze
- RX_OTHER_EXCEPTION_LINE =
Rest is expanded as
at com.other.OtherClass.someMethod(OtherClass.java:42)
Source marker can be just “Native Method” or “Unknown Source”
/((at [a-zA-Z$.]+)|(Caused by:)|(\.\.\. [0-9]* more))(.+)?$/.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(string) ⇒ JavaTraceScanner
constructor
A new instance of JavaTraceScanner.
-
#parser(files) ⇒ Tracetool::BaseTraceParser
Create parser for current trace format.
- #process(_ctx) ⇒ Object
Constructor Details
#initialize(string) ⇒ JavaTraceScanner
Returns a new instance of JavaTraceScanner.
27 28 29 |
# File 'lib/tracetool/android/java.rb', line 27 def initialize(string) @trace = string end |
Class Method Details
.[](string) ⇒ Object
52 53 54 |
# File 'lib/tracetool/android/java.rb', line 52 def [](string) new(string) if match(string) end |
.match(string) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/tracetool/android/java.rb', line 44 def match(string) # Split into lines first, *rest = string.split("\n") return unless RX_FIRST_EXCEPTION_LINE.match(first) rest.all? { |line| RX_OTHER_EXCEPTION_LINE.match(line) } end |
Instance Method Details
#parser(files) ⇒ Tracetool::BaseTraceParser
Create parser for current trace format
39 40 41 |
# File 'lib/tracetool/android/java.rb', line 39 def parser(files) JavaTraceParser.new(files) end |
#process(_ctx) ⇒ Object
31 32 33 |
# File 'lib/tracetool/android/java.rb', line 31 def process(_ctx) @trace end |