use of java.util.prefs.BackingStoreException in project cayenne by apache.
the class ChildrenMapPreference method save.
public void save() {
if (removeObject.size() > 0) {
for (String aRemoveObject : removeObject) {
try {
delegate.getCurrentPreference().node(aRemoveObject).removeNode();
} catch (BackingStoreException e) {
throw new CayenneRuntimeException("Error saving preference");
}
}
}
for (Map.Entry<String, Object> pairs : children.entrySet()) {
delegate.getCurrentPreference().node(pairs.getKey());
((CayennePreference) pairs.getValue()).saveObjectPreference();
}
}
use of java.util.prefs.BackingStoreException in project cayenne by apache.
the class RenamedPreferences method removeOldPreferences.
public static void removeOldPreferences() {
if (oldNode != null) {
Iterator<Preferences> it = oldNode.iterator();
while (it.hasNext()) {
Preferences pref = it.next();
try {
pref.removeNode();
} catch (BackingStoreException e) {
} catch (IllegalStateException e) {
// do nothing
}
}
clearPreferences();
}
}
use of java.util.prefs.BackingStoreException in project cayenne by apache.
the class RenamedPreferences method childrenCopy.
private static ArrayList<Preferences> childrenCopy(Preferences pref, String oldPath, String newPath) {
try {
String[] children = pref.childrenNames();
ArrayList<Preferences> prefChild = new ArrayList<Preferences>();
for (int j = 0; j < children.length; j++) {
String child = children[j];
// get old preference
Preferences childNode = pref.node(child);
if (!equalsPath(oldNode, childNode)) {
// path to node
String path = childNode.absolutePath().replace(oldPath, newPath);
// copy all preferences in this node
String[] names = childNode.keys();
Preferences newPref = Preferences.userRoot().node(path);
for (int i = 0; i < names.length; i++) {
newPref.put(names[i], childNode.get(names[i], ""));
}
prefChild.add(newPref);
}
}
return prefChild;
} catch (BackingStoreException e) {
}
return null;
}
Aggregations