Skip to content

Instantly share code, notes, and snippets.

@sideshowbarker
Created October 1, 2012 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sideshowbarker/3809647 to your computer and use it in GitHub Desktop.
Save sideshowbarker/3809647 to your computer and use it in GitHub Desktop.
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 14:35:28 2012 +0900
@@ -22,6 +22,7 @@
package org.whattf.datatype;
+import org.mozilla.javascript.ContextFactory;
import org.mozilla.javascript.EcmaError;
import org.mozilla.javascript.regexp.RegExpImpl;
import org.relaxng.datatype.DatatypeException;
@@ -58,9 +59,10 @@
throws DatatypeException {
// TODO find out what kind of thread concurrency guarantees are made
RegExpImpl rei = new RegExpImpl();
+ ContextFactory cf = new ContextFactory();
String anchoredRegex = "^(?:" + literal + ")$";
try {
- rei.compileRegExp(null, anchoredRegex, "");
+ rei.compileRegExp(cf.enterContext(), anchoredRegex, "");
} catch (EcmaError ee) {
throw newDatatypeException(ee.getErrorMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment