A few more BSON fixes

This commit is contained in:
Kyle Banker 2010-10-04 14:25:44 -04:00
parent 112870b537
commit b8d6f57602
4 changed files with 5 additions and 4 deletions

Binary file not shown.

View File

@ -265,12 +265,15 @@ public class RubyBSONCallback implements BSONCallback {
public void gotObjectId( String name , ObjectId id ){ public void gotObjectId( String name , ObjectId id ){
byte[] jbytes = id.toByteArray(); byte[] jbytes = id.toByteArray();
RubyArray arg = ja2ra(jbytes); RubyArray arg = RubyArray.newArray( _runtime, 12 );
for( int i=0; i<jbytes.length; i++) {
arg.store( i, _runtime.newFixnum(jbytes[i] & 0xFF) );
}
Object[] args = new Object[] { arg }; Object[] args = new Object[] { arg };
Object result = JavaEmbedUtils.invokeMethod(_runtime, _rbclsObjectId, "new", args, Object.class); Object result = JavaEmbedUtils.invokeMethod(_runtime, _rbclsObjectId, "new", args, Object.class);
_put( name, (RubyObject)result ); _put( name, (RubyObject)result );
} }
// TODO: Incredibly annoying to deserialize to a Ruby DBRef. Might just // TODO: Incredibly annoying to deserialize to a Ruby DBRef. Might just

View File

@ -565,8 +565,6 @@ module BSON
ARRAY ARRAY
when Regexp when Regexp
REGEX REGEX
when ObjectID
OID
when ObjectId when ObjectId
OID OID
when DBRef when DBRef