Skip to content

Commit e3e859f

Browse files
committed
Rhino on Dalvik/ART
Can't guarantee this will fix the android issues, but it will work around at least one issue according to my research. Fixes: java-json-tools/json-schema-validator#153
1 parent ee4836e commit e3e859f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ apply(plugin: "idea");
2525
apply(plugin: "eclipse");
2626

2727
group = "com.box";
28-
version = "1.2.6";
28+
version = "1.2.7";
2929
sourceCompatibility = "1.6";
3030
targetCompatibility = "1.6"; // defaults to sourceCompatibility
3131

src/main/java/com/github/fge/jsonschema/core/util/RhinoHelper.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ private RhinoHelper()
9090
final Context ctx = Context.enter();
9191
try {
9292
SCOPE = ctx.initStandardObjects(null, false);
93-
ctx.evaluateString(SCOPE, jsAsString, "re", 1, null);
93+
try {
94+
ctx.evaluateString(SCOPE, jsAsString, "re", 1, null);
95+
} catch(UnsupportedOperationException e) {
96+
ctx.setOptimizationLevel(-1);
97+
ctx.evaluateString(SCOPE, jsAsString, "re", 1, null);
98+
}
9499
REGEX_IS_VALID = (Function) SCOPE.get("regexIsValid", SCOPE);
95100
REG_MATCH = (Function) SCOPE.get("regMatch", SCOPE);
96101
} finally {

0 commit comments

Comments
 (0)