Closed Bug 495785 Opened 15 years ago Closed 15 years ago

Rhino interpreter shell crashes with NullPointerException

Categories

(Rhino Graveyard :: Core, defect)

All
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: a.badger, Unassigned)

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b4) Gecko/20090427 Fedora/3.5-0.20.beta4.fc11 Firefox/3.5b4
Build Identifier: Rhino-1.7r2

On Fedora Linux with rhino-1.7r2, scripts can run but trying to run the interactive shell throws a NullPointerException.  The cause is diagnosed in this bug in the Fedora bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=457336


Reproducible: Always

Steps to Reproduce:
1. $ java org.mozilla.javascript.tools.shell.Main
2.
3.
Actual Results:  
Rhino 1.7 release 0.5.r2.fc10 2009 04 23
Exception in thread "main" java.lang.NullPointerException
 at org.mozilla.javascript.Kit.classOrNull(Kit.java:92)
 at org.mozilla.javascript.tools.shell.ShellLine.getStream(ShellLine.java:65)
 at org.mozilla.javascript.tools.shell.Global.getIn(Global.java:829)
 at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:385)
 at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:196)
 at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:117)
 at org.mozilla.javascript.Context.call(Context.java:515)
 at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:507)
 at org.mozilla.javascript.tools.shell.Main.exec(Main.java:179)
 at org.mozilla.javascript.tools.shell.Main.main(Main.java:157)



Expected Results:  
Rhino 1.7 release 0.6.r2.fc11 2009 05 31
js>


Steven Elliot diagnosed the bug in the Fedora bug tracker and came up with the following:

"""
I've looked into the null pointer exception quoted above. I believe it's a
result of Rhino attempting to dynamically load the jline library.  My
understanding is that there are both class specific class loaders and a generic
system class loader.  With this fix both will be attempted, if necessary, to
dynamically load a jline class.
"""

I'll attach his patch (which fixes the exception).
Steven Elliott's patch to try the class specific loader for jline, then the system loader, then return null if no jline was found.
Here's the same patch minus changes to a Fedora-local script to invoke rhino with jline support.
Attachment #380840 - Attachment is obsolete: true
Fixed in CVS:

Checking in toolsrc/org/mozilla/javascript/tools/shell/ShellLine.java;
/cvsroot/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/ShellLine.java,v  <--  ShellLine.java
new revision: 1.5; previous revision: 1.4
done

Thanks!
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: