1
0
forked from GitHub/gf-core

the constructor for expressions in the Java runtime now checks for null arguments. This means that a potential problem is detected earlier before we jump into the JNI code.

This commit is contained in:
krasimir
2016-05-19 20:41:09 +00:00
parent 214d1b1e70
commit 4996d5d90b

View File

@@ -23,6 +23,9 @@ public class Expr implements Serializable {
/** Constructs an expression which represents a string literal */
public Expr(String s) {
if (s == null)
throw new IllegalArgumentException("s == null");
this.pool = new Pool();
this.master = null;
this.ref = initStringLit(s, pool.ref);
@@ -33,6 +36,13 @@ public class Expr implements Serializable {
* @param args the arguments for the function.
*/
public Expr(String fun, Expr... args) {
if (fun == null)
throw new IllegalArgumentException("fun == null");
for (int i = 0; i < args.length; i++) {
if (args[i] == null)
throw new IllegalArgumentException("the "+i+"th argument is null");
}
this.pool = new Pool();
this.master = Arrays.copyOf(args, args.length);
this.ref = initApp(fun, args, pool.ref);