}
}
private void writeObjects(Persistor p) {
Persistor root = p.createChild("Objects");
DatabaseObjectPersistor op = new DatabaseObjectPersistor();
for (DatabaseObject o : objects.keySet()) {
if (o == null) {
// When upgrading from certain pre-release 2.0 versions we may end up in the
// situation where objects contains null-keys. If that happens we must erase
// all restored objects information and pretend it was never there in the first
// place, otherwise we risk ending up in an inconsistent state.
return;
}
}
for (Map.Entry<DatabaseObject, Integer> e : objects.entrySet()) {
Persistor item = root.createChild("Item");
op.save(e.getKey(), item.createChild("Object"));
item.putInteger("value", e.getValue());
}
}