b13b51fb by Adam Heath

The javascript code will return null when there are no errors, but I'd

prefer to have an empty map returned in java land; so check for that and
do the right thing.
1 parent b3c08c71
...@@ -68,7 +68,11 @@ public class Require { ...@@ -68,7 +68,11 @@ public class Require {
68 NativeObject r = container.call(modelInstance, "toJSON", container.javaToJS(extraOptions)); 68 NativeObject r = container.call(modelInstance, "toJSON", container.javaToJS(extraOptions));
69 System.err.printf("r[%s]=%s\n", moduleId, container.toMap(r)); 69 System.err.printf("r[%s]=%s\n", moduleId, container.toMap(r));
70 NativeObject errors = RhinoContainer.allowUndefined(container.call(modelInstance, "validate")); 70 NativeObject errors = RhinoContainer.allowUndefined(container.call(modelInstance, "validate"));
71 return new HashMap<String, Object>(errors); 71 if (errors == null) {
72 return new HashMap<String, Object>();
73 } else {
74 return new HashMap<String, Object>(errors);
75 }
72 } 76 }
73 77
74 public static class Loader extends InContext<Function> { 78 public static class Loader extends InContext<Function> {
......