Permalink
Browse files

Fix for newRegexp() on JRuby 1.6.7

  • Loading branch information...
1 parent 4da2703 commit 349d37f3db86dfe5b81dffe364c4d9eb667d9e80 @banker banker committed Feb 27, 2012
View
BIN ext/java/jar/jbson.jar
Binary file not shown.
View
BIN ext/java/jar/jruby.jar
Binary file not shown.
View
12 ext/java/src/org/jbson/RubyBSONCallback.java
@@ -9,6 +9,7 @@
import org.jruby.runtime.Block;
import org.jruby.runtime.CallType;
import org.jruby.runtime.callsite.CacheEntry;
+import org.jruby.util.RegexpOptions;
import org.jruby.javasupport.JavaEmbedUtils;
import org.jruby.javasupport.JavaUtil;
@@ -226,22 +227,23 @@ public void gotDate( String name , long millis ){
public void gotRegex( String name , String pattern , String flags ){
int f = 0;
+ RegexpOptions opts = new RegexpOptions();
ByteList b = new ByteList(pattern.getBytes());
if(flags.contains("i")) {
- f = f | ReOptions.RE_OPTION_IGNORECASE;
+ opts.setIgnorecase(true);
}
if(flags.contains("m")) {
- f = f | ReOptions.RE_OPTION_MULTILINE;
+ opts.setMultiline(true);
}
if(flags.contains("s")) {
- f = f | ReOptions.RE_OPTION_MULTILINE;
+ opts.setMultiline(true);
}
if(flags.contains("x")) {
- f = f | ReOptions.RE_OPTION_EXTENDED;
+ opts.setExtended(true);
}
- _put( name , RubyRegexp.newRegexp(_runtime, b, f) );
+ _put( name , RubyRegexp.newRegexp(_runtime, b, opts) );
}
public void gotString( String name , String v ){

0 comments on commit 349d37f

Please sign in to comment.