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,8 +68,12 @@ public class Require { ...@@ -68,8 +68,12 @@ 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 if (errors == null) {
72 return new HashMap<String, Object>();
73 } else {
71 return new HashMap<String, Object>(errors); 74 return new HashMap<String, Object>(errors);
72 } 75 }
76 }
73 77
74 public static class Loader extends InContext<Function> { 78 public static class Loader extends InContext<Function> {
75 private final RhinoContainer<?> container; 79 private final RhinoContainer<?> container;
......