Platform.getPackageName() NPE when embedded. --------------------------------------------
Key: JRUBY-6024 URL: https://jira.codehaus.org/browse/JRUBY-6024 Project: JRuby Issue Type: Bug Affects Versions: JRuby 1.6.4 Environment: notes from me: * I am unsure of the constantine/constants etc actually included w/ JR 1.6.5. Reporter: Miroslav Pokorny Assignee: Thomas E Enebo *AFFECTED VERSION* Before i get started, i am actually complaining about 1.6.5 (five) which is officially available from jruby.org but Affected versions only goes up to 1.6.4 *REAL DESCRIPTION* I am getting a NPE using an embedded JRuby which is loaded from a non system ClassLoader. The stack trace below demonstrates the problem (note i have kept the interesting frames). java.lang.NullPointerException at com.kenai.constantine.Platform.getPackageName(Platform.java:39) at com.kenai.constantine.ConstantSet.getEnumClass(ConstantSet.java:84) at com.kenai.constantine.ConstantSet.getConstantSet(ConstantSet.java:60) at com.kenai.constantine.platform.ConstantResolver.getConstants(ConstantResolver.java:181) at com.kenai.constantine.platform.ConstantResolver.getConstant(ConstantResolver.java:102) at com.kenai.constantine.platform.ConstantResolver.intValue(ConstantResolver.java:146) at com.kenai.constantine.platform.OpenFlags.value(OpenFlags.java:28) at org.jruby.RubyFile.createFileClass(RubyFile.java:265) at org.jruby.Ruby.initCore(Ruby.java:1269) at org.jruby.Ruby.bootstrap(Ruby.java:1099) at org.jruby.Ruby.init(Ruby.java:1071) at org.jruby.Ruby.newInstance(Ruby.java:186) at org.jruby.embed.internal.LocalContext.getThreadSafeRuntime(LocalContext.java:69) at org.jruby.embed.internal.ThreadSafeLocalContextProvider.getRuntime(ThreadSafeLocalContextProvider.java:61) at org.jruby.embed.ScriptingContainer.terminate(ScriptingContainer.java:1721) Sorry i cannot comment on the Constantine that is actually used as jruby-complete.jar does not include C source. Note being uninformed i could not easily determine which version of C is actually bundled. My guess is that java.lang.Package.getPackage(String) returns null because the class is not coming from the System ClassLoader. The easy fix was to grab a *fixed* C from https://github.com/jnr/jnr-constants. after which everything just works. This was previously discussed at http://www.ruby-forum.com/topic/2321320. Thanks Wayne for the fix and everyone else for JR. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email