Title: [1033] trunk/rcov4jr/java/src/CallsiteHook.java:
Fix for the nil exception that showed up during test execution.
- Revision
- 1033
- Author
- kofno
- Date
- 2008-06-26 22:07:01 -0400 (Thu, 26 Jun 2008)
Log Message
Fix for the nil exception that showed up during test execution.
Modified Paths
Diff
Modified: trunk/rcov4jr/java/src/CallsiteHook.java (1032 => 1033)
--- trunk/rcov4jr/java/src/CallsiteHook.java 2008-06-27 02:06:47 UTC (rev 1032)
+++ trunk/rcov4jr/java/src/CallsiteHook.java 2008-06-27 02:07:01 UTC (rev 1033)
@@ -79,6 +79,7 @@
Long count = (Long) hash.get(callerArray);
long itCount = count.longValue() + 1L;
hash.put(callerArray, Long.valueOf(itCount));
+
}
private RubyArray customBacktrace(ThreadContext context) {
@@ -102,28 +103,30 @@
* @return
*/
private RubyArray formatBacktrace(Ruby runtime, String backtrace) {
+ RubyArray ary = runtime.newArray();
if ( backtrace == null ) {
- System.out.println( "backtrace is null" );
- return runtime.newArray();
- }
-
- Matcher matcher = backtracePattern.matcher(backtrace);
+ ary.add(runtime.getNil());
+ ary.add("");
+ ary.add(Long.valueOf(0));
+ } else {
+ Matcher matcher = backtracePattern.matcher(backtrace);
- RubyArray ary = runtime.newArray();
- if (matcher.matches()) {
- String method = matcher.group(4);
- String file = matcher.group(1);
- String line = matcher.group(2);
- Long lineNum = ( line == null ?
- Long.valueOf( 0 ) :
- Long.valueOf( line ) );
+ if (matcher.matches()) {
+ String method = matcher.group(4);
+ String file = matcher.group(1);
+ String line = matcher.group(2);
+ Long lineNum = ( line == null ?
+ Long.valueOf( 0 ) :
+ Long.valueOf( line ) );
- ary.add( ( method == null ?
- runtime.getNil() :
- runtime.newSymbol( method ) ) );
- ary.add(file);
- ary.add(lineNum);
+ ary.add( ( method == null ?
+ runtime.getNil() :
+ runtime.newSymbol( method ) ) );
+ ary.add(file);
+ ary.add(lineNum);
+ }
}
+
return ary;
}
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel