java.util.prefs.Preferences sync() not throwing IllegalStateException
when node is removed.
Program is below:
import java.util.prefs.*;
import java.util.*;
public class Sync {
public static void main(String[] args) throws Exception {
try {
Preferences userRoot = Preferences.userRoot();
Preferences N1 = userRoot.node("N1");
Preferences N2 = N1.node("N2");
N1.put("k1","v1");
N2.put("k2","v2");
N2.removeNode();
N2.sync();
System.out.println("Sync Test Fail");
} catch(IllegalStateException ise) {
System.out.println("Expected IllegalStateException thrown Sync Test Pass");
} catch(Exception e) {
System.out.println("Exception thrown = " + e);
System.out.println("Sync Test Fail");
e.printStackTrace();
}
}
}
when node is removed.
Program is below:
import java.util.prefs.*;
import java.util.*;
public class Sync {
public static void main(String[] args) throws Exception {
try {
Preferences userRoot = Preferences.userRoot();
Preferences N1 = userRoot.node("N1");
Preferences N2 = N1.node("N2");
N1.put("k1","v1");
N2.put("k2","v2");
N2.removeNode();
N2.sync();
System.out.println("Sync Test Fail");
} catch(IllegalStateException ise) {
System.out.println("Expected IllegalStateException thrown Sync Test Pass");
} catch(Exception e) {
System.out.println("Exception thrown = " + e);
System.out.println("Sync Test Fail");
e.printStackTrace();
}
}
}