diff --git a/Rakefile b/Rakefile index 35a4c84..65de58c 100644 --- a/Rakefile +++ b/Rakefile @@ -26,7 +26,7 @@ namespace :build do jar_dir = File.join(java_dir, 'jar') jruby_jar = File.join(jar_dir, 'jruby.jar') - mongo_jar = File.join(jar_dir, 'mongo-2.2.jar') + mongo_jar = File.join(jar_dir, 'mongo-2.4.jar') bson_jar = File.join(jar_dir, 'bson-2.2.jar') src_base = File.join(java_dir, 'src') diff --git a/ext/java/jar/jbson.jar b/ext/java/jar/jbson.jar index 720fc27..d56c190 100644 Binary files a/ext/java/jar/jbson.jar and b/ext/java/jar/jbson.jar differ diff --git a/ext/java/src/org/jbson/RubyBSONEncoder.java b/ext/java/src/org/jbson/RubyBSONEncoder.java index 8dbd1b0..9e1a8e2 100644 --- a/ext/java/src/org/jbson/RubyBSONEncoder.java +++ b/ext/java/src/org/jbson/RubyBSONEncoder.java @@ -293,7 +293,7 @@ public class RubyBSONEncoder extends BSONEncoder { else if ( val instanceof RubyObject ) { if ( val instanceof RubyString ) { - putRubyString(name, ((RubyString)val).getUnicodeValue() ); + putRubyString(name, (RubyString)val); } else if (val instanceof RubySymbol) { @@ -582,10 +582,13 @@ public class RubyBSONEncoder extends BSONEncoder { _putString(name, s.getSymbol(), SYMBOL); } - protected void putRubyString( String name , String s ) { - _put( STRING , name ); - _putValueString( s ); - } + protected void putRubyString( String name , RubyString s ) { + byte[] bytes = s.getBytes(); + _put( STRING , name ); + _buf.writeInt( bytes.length + 1); + _buf.write( bytes ); + _buf.write( (byte)0 ); + } protected void putString(String name, String s) { _putString(name, s, STRING);