8071588: The spec for javax.script.ScriptEngineFactory.getProgram() should specify NPEs thrown
Reviewed-by: alanb, hannesw
This commit is contained in:
parent
8d889c2a92
commit
b82ec86107
@ -216,8 +216,9 @@ public interface ScriptEngineFactory {
|
|||||||
* @param statements The statements to be executed. May be return values of
|
* @param statements The statements to be executed. May be return values of
|
||||||
* calls to the <code>getMethodCallSyntax</code> and <code>getOutputStatement</code> methods.
|
* calls to the <code>getMethodCallSyntax</code> and <code>getOutputStatement</code> methods.
|
||||||
* @return The Program
|
* @return The Program
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if the <code>statements</code> array or any of its elements is null
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public String getProgram(String... statements);
|
public String getProgram(String... statements);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,9 +91,10 @@ public class DummyScriptEngineFactory implements ScriptEngineFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getProgram(String... statements) {
|
public String getProgram(String... statements) {
|
||||||
|
Objects.requireNonNull(statements);
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
for (int i = 0; i < statements.length; i++) {
|
for (String stat : statements) {
|
||||||
buf.append(statements[i]);
|
buf.append(Objects.requireNonNull(stat));
|
||||||
}
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user