nuvolabase/orientdb — pull request #1385 by henryzhao81 (2013-03-07 22:38:31+00:00)
Title: Error unmarshalling json object from distributed configuration file

When start with Distributed mode, OSerializtionException happened.
Error on unmarshalling JSON content: wrong format. Use : .
Exception happened at ORecordSerializerJSON.java Method : fromString
if (fields.size() % 2 != 0)
throw new OSerializationException("Error on unmarshalling JSON content: wrong format. Use : ");
Due to "," at the end of json, this fields number is 9 not 8. Easiest solution, remove "," before end of json object

Write some simple test code to verify.

public static void testloadDatabaseConfiguration(final String filePath) {
File file = new File(filePath);
if (!file.exists() || file.length() == 0)
return;
FileInputStream f = null;
try {
f = new FileInputStream(file);
final byte[] buffer = new byte[(int) file.length()];
f.read(buffer);
System.out.println(" : " + new String(buffer));
ODocument doc = (ODocument) new ODocument().fromJSON(new String(buffer), "noMap");
} catch (Exception e) {
} finally {
if (f != null)
try {
f.close();
} catch (IOException e) {
}
}
}