ringo/ringojs — Issue #158: syntax error in module throws NPE
Author: oberhamsi
Created: 2011-11-24 11:07:30+00:00
State: open

very weird. this definitely used to work.

for example, module `foo.js` (note syntax error at EOL):

var test = 'foo':

and when i try to require() that module:

simon@duchov:~/ositestats$ ringo --verbose
Loading module: system
>> Loading module: ringo/shell
Loading module: ringo/term
Loading module: io
Loading module: binary
Loading module: ringo/encoding
Loading module: ringo/logging
Loading module: ringo/utils/strings
Loading module: ringo/events
Loading module: ringo/engine
require('./foo')
Wrapped java.lang.NullPointerException (#1)
Wrapped java.lang.NullPointerException (#1)
at :1
Java Exception: java.lang.NullPointerException
at org.ringojs.engine.ReloadableScript.getScript(ReloadableScript.java:123)
at org.ringojs.engine.ReloadableScript.load(ReloadableScript.java:215)
at org.ringojs.engine.RingoWorker.loadModule(RingoWorker.java:197)
at org.ringojs.engine.RingoGlobal.require(RingoGlobal.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:413)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
at org.mozilla.javascript.gen._stdin__12._c_script_0(:1)
at org.mozilla.javascript.gen._stdin__12.call()
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3178)
at org.mozilla.javascript.gen._stdin__12.call()
at org.mozilla.javascript.gen._stdin__12.exec()
at org.ringojs.tools.RingoShell.run(RingoShell.java:107)
at org.ringojs.tools.RingoRunner.run(RingoRunner.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.ringojs.tools.launcher.Main.run(Main.java:66)
at org.ringojs.tools.launcher.Main.main(Main.java:45)