Class: Tracetool::Android::JavaTraceScanner

Inherits:
Object
  • Object
show all
Defined in:
lib/tracetool/android/java.rb

Overview

Processes java traces

Constant Summary collapse

RX_FIRST_EXCEPTION_LINE =
/^.+$/
RX_OTHER_EXCEPTION_LINE =
/at [^(]+\(([^:]+:\d+)|(Native Method)\)$/

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ JavaTraceScanner

Returns a new instance of JavaTraceScanner.



21
22
23
# File 'lib/tracetool/android/java.rb', line 21

def initialize(string)
  @trace = string
end

Class Method Details

.[](string) ⇒ Object



48
49
50
# File 'lib/tracetool/android/java.rb', line 48

def [](string)
  new(string) if match(string)
end

.match(string) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/tracetool/android/java.rb', line 38

def match(string)
  # Split into lines
  first, *rest = string.split("\n")

  return if rest.nil? || rest.empty?
  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

Parameters:

  • files (Array)

    list of files used in build. This files are used to match file entries from stack trace to real files

Returns:



33
34
35
# File 'lib/tracetool/android/java.rb', line 33

def parser(files)
  JavaTraceParser.new(files)
end

#process(_ctx) ⇒ Object



25
26
27
# File 'lib/tracetool/android/java.rb', line 25

def process(_ctx)
  @trace
end