Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 50fa133

Browse files
committedSep 28, 2015
Merge pull request #2 from box-metadata/RhinoOnAndroid
Rhino on Dalvik/ART
2 parents ee4836e + 077d69b commit 50fa133

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-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: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,13 @@ 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+
// See: http://stackoverflow.com/questions/3859305/problems-using-rhino-on-android
97+
ctx.setOptimizationLevel(-1);
98+
ctx.evaluateString(SCOPE, jsAsString, "re", 1, null);
99+
}
94100
REGEX_IS_VALID = (Function) SCOPE.get("regexIsValid", SCOPE);
95101
REG_MATCH = (Function) SCOPE.get("regMatch", SCOPE);
96102
} finally {

0 commit comments

Comments
 (0)
Please sign in to comment.