Note: There are a few cases of duplicates in user autocompletion which are being worked on.

Rhino interpreter shell crashes with NullPointerException

RESOLVED FIXED

Status

Rhino
Core
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: Toshio Kuratomi, Unassigned)

Tracking

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

8 years ago
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).
(Reporter)

Comment 1

8 years ago
Created attachment 380840 [details] [diff] [review]
Patch to fallback to system jline if class specific loader fails

Steven Elliott's patch to try the class specific loader for jline, then the system loader, then return null if no jline was found.
(Reporter)

Comment 2

8 years ago
Created attachment 380856 [details] [diff] [review]
Same patch minus Fedora script changes

Here's the same patch minus changes to a Fedora-local script to invoke rhino with jline support.
Attachment #380840 - Attachment is obsolete: true

Comment 3

8 years ago
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
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.