changeset 1796:0d5081c856bc

8071588: The spec for javax.script.ScriptEngineFactory.getProgram() should specify NPEs thrown Reviewed-by: alanb, hannesw
author sundar
date Wed, 19 Oct 2016 13:27:20 +0530
parents a46b7d386795
children e8627495578f
files src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/NashornScriptEngineFactory.java
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/NashornScriptEngineFactory.java	Thu Oct 13 23:03:33 2016 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/NashornScriptEngineFactory.java	Wed Oct 19 13:27:20 2016 +0530
@@ -129,10 +129,11 @@
 
     @Override
     public String getProgram(final String... statements) {
+        Objects.requireNonNull(statements);
         final StringBuilder sb = new StringBuilder();
 
         for (final String statement : statements) {
-            sb.append(statement).append(';');
+            sb.append(Objects.requireNonNull(statement)).append(';');
         }
 
         return sb.toString();