Skip to content

Commit b8d6f57

Browse files
committed
A few more BSON fixes
1 parent 112870b commit b8d6f57

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

ext/java/jar/jbson.jar

-3.67 KB
Binary file not shown.
85 Bytes
Binary file not shown.

ext/java/src/org/jbson/RubyBSONCallback.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,15 @@ public void gotTimestamp( String name , int time , int inc ){
265265

266266
public void gotObjectId( String name , ObjectId id ){
267267
byte[] jbytes = id.toByteArray();
268-
RubyArray arg = ja2ra(jbytes);
268+
RubyArray arg = RubyArray.newArray( _runtime, 12 );
269+
for( int i=0; i<jbytes.length; i++) {
270+
arg.store( i, _runtime.newFixnum(jbytes[i] & 0xFF) );
271+
}
269272
Object[] args = new Object[] { arg };
270273

271274
Object result = JavaEmbedUtils.invokeMethod(_runtime, _rbclsObjectId, "new", args, Object.class);
272275

273-
_put( name, (RubyObject)result );
276+
_put( name, (RubyObject)result );
274277
}
275278

276279
// TODO: Incredibly annoying to deserialize to a Ruby DBRef. Might just

lib/bson/bson_ruby.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,6 @@ def bson_type(o)
565565
ARRAY
566566
when Regexp
567567
REGEX
568-
when ObjectID
569-
OID
570568
when ObjectId
571569
OID
572570
when DBRef

0 commit comments

Comments
 (0)