-
Bug
-
Resolution: Fixed
-
P3
-
8u112, 9.0.1, 10
-
b36
-
x86_64
-
windows
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8249614 | openjdk8u272 | Hannes Wallnoefer | P3 | Resolved | Fixed | b01 |
JDK-8224511 | 8u261 | Ravi Reddy | P3 | Resolved | Fixed | b02 |
JDK-8247182 | emb-8u261 | Hannes Wallnoefer | P3 | Resolved | Fixed | team |
FULL PRODUCT VERSION :
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.16299.98]
A DESCRIPTION OF THE PROBLEM :
Nashorn crashes with NullPointerException when passed an empty script file:
jjs empty.js
Fails only when file is totally empty, size=0. If file contains a single space character, or a single '0' character, does not crash.
REGRESSION. Last worked in version 7u79
ADDITIONAL REGRESSION INFORMATION:
I know the empty file did work OK in a *fairly* recent prior version, but not certain which one. Just tried using java 8 and it failed the same way. Just guessing about java 7.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run:
jjs empty.js
where empty.js is a zero-length file.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should to nothing, and not crash An empty string is a valid JavaScript program.
ACTUAL -
Crashes.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
>jjs empty.js
Exception in thread "main" java.lang.NullPointerException
at jdk.scripting.nashorn/jdk.nashorn.tools.Shell.preprocessArgs(Shell.java:298)
at jdk.scripting.nashorn/jdk.nashorn.tools.Shell.makeContext(Shell.java:213)
at jdk.scripting.nashorn/jdk.nashorn.tools.Shell.run(Shell.java:166)
at jdk.scripting.nashorn.shell/jdk.nashorn.tools.jjs.Main.main(Main.java:104)
at jdk.scripting.nashorn.shell/jdk.nashorn.tools.jjs.Main.main(Main.java:80)
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
I use this command to get the Nashorn version from another program:
jjs -v empty.js
This is the only way I know to get the version. If the "empty.js" argument is omitted, interactive mode is entered.
This used to work with an empty file, but now crashes. Workaround is to put a space in empty.js.
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.16299.98]
A DESCRIPTION OF THE PROBLEM :
Nashorn crashes with NullPointerException when passed an empty script file:
jjs empty.js
Fails only when file is totally empty, size=0. If file contains a single space character, or a single '0' character, does not crash.
REGRESSION. Last worked in version 7u79
ADDITIONAL REGRESSION INFORMATION:
I know the empty file did work OK in a *fairly* recent prior version, but not certain which one. Just tried using java 8 and it failed the same way. Just guessing about java 7.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run:
jjs empty.js
where empty.js is a zero-length file.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should to nothing, and not crash An empty string is a valid JavaScript program.
ACTUAL -
Crashes.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
>jjs empty.js
Exception in thread "main" java.lang.NullPointerException
at jdk.scripting.nashorn/jdk.nashorn.tools.Shell.preprocessArgs(Shell.java:298)
at jdk.scripting.nashorn/jdk.nashorn.tools.Shell.makeContext(Shell.java:213)
at jdk.scripting.nashorn/jdk.nashorn.tools.Shell.run(Shell.java:166)
at jdk.scripting.nashorn.shell/jdk.nashorn.tools.jjs.Main.main(Main.java:104)
at jdk.scripting.nashorn.shell/jdk.nashorn.tools.jjs.Main.main(Main.java:80)
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
I use this command to get the Nashorn version from another program:
jjs -v empty.js
This is the only way I know to get the version. If the "empty.js" argument is omitted, interactive mode is entered.
This used to work with an empty file, but now crashes. Workaround is to put a space in empty.js.
- backported by
-
JDK-8224511 Nashorn crashes when given an empty script file.
-
- Resolved
-
-
JDK-8247182 Nashorn crashes when given an empty script file.
-
- Resolved
-
-
JDK-8249614 Nashorn crashes when given an empty script file.
-
- Resolved
-