Another boundary case for JSON

27 views
Skip to first unread message

Nicole King

unread,
Nov 27, 2011, 8:16:24 AM11/27/11
to orient-...@googlegroups.com
Test case for revision 4236:

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.record.impl.ODocument;

public class TestCase1 {

/**
* @param args
*/
public static void main(String[] args) {
ODatabaseDocumentTx database = new ODatabaseDocumentTx(args[0]);
database.open("admin", "admin");

ODocument doc = new ODocument(database)

.fromJSON("{name:{\"%Field\":[\"value1\",\"value2\"],\"%Field2\":{},\"%Field3\":\"value3\"}}");
doc.save();

ODocument doc2 = database.load(doc.getIdentity());
org.junit.Assert.assertEquals(doc, doc2);
}
}


Result:
Exception in thread "main"
com.orientechnologies.orient.core.exception.ODatabaseException: Error on
saving record in cluster #-1
at
com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.executeSaveRecord(ODatabaseRecordAbstract.java:601)
at
com.orientechnologies.orient.core.tx.OTransactionNoTx.saveRecord(OTransactionNoTx.java:66)
at
com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.save(ODatabaseRecordTx.java:211)
at
com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.save(ODatabaseRecordTx.java:206)
at
com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.save(ODatabaseRecordTx.java:42)
at
com.orientechnologies.orient.core.db.ODatabaseRecordWrapperAbstract.save(ODatabaseRecordWrapperAbstract.java:223)
at
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseDocumentTx.java:122)
at
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseDocumentTx.java:34)
at
com.orientechnologies.orient.core.record.ORecordAbstract.save(ORecordAbstract.java:273)
at
com.orientechnologies.orient.core.record.ORecordSchemaAwareAbstract.save(ORecordSchemaAwareAbstract.java:57)
at TestCase1.main(TestCase1.java:15)
Caused by: java.lang.IllegalArgumentException: Argument is not an array
at java.lang.reflect.Array.getLength(Native Method)
at
com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerCSVAbstract.embeddedCollectionToStream(ORecordSerializerCSVAbstract.java:581)
at
com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerStringAbstract.fieldTypeToString(ORecordSerializerStringAbstract.java:268)
at
com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerCSVAbstract.embeddedMapToStream(ORecordSerializerCSVAbstract.java:482)
at
com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerCSVAbstract.fieldToStream(ORecordSerializerCSVAbstract.java:378)
at
com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerSchemaAware2CSV.toString(ORecordSerializerSchemaAware2CSV.java:245)
at
com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerStringAbstract.toStream(ORecordSerializerStringAbstract.java:79)
at
com.orientechnologies.orient.core.record.ORecordSchemaAwareAbstract.toStream(ORecordSchemaAwareAbstract.java:137)
at
com.orientechnologies.orient.core.record.ORecordSchemaAwareAbstract.toStream(ORecordSchemaAwareAbstract.java:132)
at
com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.executeSaveRecord(ODatabaseRecordAbstract.java:530)
... 10 more

Luca Garulli

unread,
Nov 27, 2011, 7:07:44 PM11/27/11
to orient-...@googlegroups.com
Hi,
fixed in SVN r4239.

Lvc@
Reply all
Reply to author
Forward
0 new messages