Forum: JRuby jruby 1.7.x backtrace not masked when calling java

D2a5cdd34483a7695df1969ba865aa6f?d=identicon&s=25 Kristy Branko (Guest)
on 2013-05-29 03:13
(Received via mailing list)
Hi,

It seems like jruby 1.7.x does not mask java calls in backtrace if call
fails in java.

Is there a way to get nice backtraces in 1.7.x for java calls?

Here is an example:

$ jruby -v
jruby 1.7.4 (ruby-1.8.7p370) 2013-05-16 2390d3b on Java HotSpot(TM)
64-Bit
Server VM 1.7.0_09-b05 [linux-amd64]

$ jruby -rjava -Xbacktrace.style=mri -Xbacktrace.mask=true
-Xcompat.version=1.9 -e 'puts "a".to_java.startsWith(nil)'
String.java:1385:in `startsWith': java.lang.NullPointerException
from String.java:1414:in `startsWith'
from NativeMethodAccessorImpl.java:-2:in `invoke0'
from NativeMethodAccessorImpl.java:57:in `invoke'
from DelegatingMethodAccessorImpl.java:43:in `invoke'
from Method.java:601:in `invoke'
from JavaMethod.java:455:in `invokeDirectWithExceptionHandling'
from JavaMethod.java:316:in `invokeDirect'
from InstanceMethodInvoker.java:61:in `call'
from CachingCallSite.java:326:in `cacheAndCall'
from CachingCallSite.java:170:in `call'
from -e:1:in `__file__'
from -e:-1:in `load'
from Ruby.java:807:in `runScript'
from Ruby.java:800:in `runScript'
from Ruby.java:669:in `runNormally'
from Ruby.java:518:in `runFromMain'
from Main.java:390:in `doRunFromMain'
from Main.java:279:in `internalRun'
from Main.java:221:in `run'
from Main.java:201:in `main'

Behavior for jruby-1.6.8:

$ jruby -v
jruby 1.6.8 (ruby-1.8.7-p357) (2012-09-18 1772b40) (Java HotSpot(TM)
64-Bit
Server VM 1.7.0_09) [linux-amd64-java]

$ jruby -rjava -Xbacktrace.style=mri -Xbacktrace.mask=true
-Xcompat.version=1.9 -e 'puts "a".to_java.startsWith(nil)'
java/lang/String.java:1385:in `startsWith':
java.lang.NullPointerException:
null (NativeException)
from java/lang/String.java:1414:in `startsWith'
from -e:1:in `(root)'

Thanks,
kbranko
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.