Created
October 1, 2012 11:58
-
-
Save sideshowbarker/3811200 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r ed90a83ab0fd relaxng/datatype/java/src/org/whattf/datatype/Pattern.java | |
--- a/relaxng/datatype/java/src/org/whattf/datatype/Pattern.java Sat Apr 21 17:35:50 2012 +0900 | |
+++ b/relaxng/datatype/java/src/org/whattf/datatype/Pattern.java Mon Oct 01 20:57:45 2012 +0900 | |
@@ -22,6 +22,8 @@ | |
package org.whattf.datatype; | |
+import org.mozilla.javascript.Context; | |
+import org.mozilla.javascript.ContextFactory; | |
import org.mozilla.javascript.EcmaError; | |
import org.mozilla.javascript.regexp.RegExpImpl; | |
import org.relaxng.datatype.DatatypeException; | |
@@ -57,12 +59,16 @@ | |
public void checkValid(CharSequence literal) | |
throws DatatypeException { | |
// TODO find out what kind of thread concurrency guarantees are made | |
+ ContextFactory cf = new ContextFactory(); | |
+ Context cx = cf.enterContext(); | |
RegExpImpl rei = new RegExpImpl(); | |
String anchoredRegex = "^(?:" + literal + ")$"; | |
try { | |
- rei.compileRegExp(null, anchoredRegex, ""); | |
+ rei.compileRegExp(cx, anchoredRegex, ""); | |
} catch (EcmaError ee) { | |
throw newDatatypeException(ee.getErrorMessage()); | |
+ } finally { | |
+ Context.exit(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment