jdk1.4 build45
java.util.prefs.Preferences sync()
In the test program :
node created, node removed
and then sync() called - IllegalStateException not thrown.
--------------Test Program--------------------
import java.util.prefs.*;
import java.util.*;
/**
*
*SyncTest : removeNode() call and check that IllegalStateException is thrown when sync() is called
*/
public class SyncTest {
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("SyncTest() Fail");
} catch(IllegalStateException ise) {
System.out.println("Expected IllegalStateException thrown SyncTest() Pass");
} catch(Exception e) {
System.out.println("Exception thrown = " + e);
System.out.println("SyncTest() Fail");
e.printStackTrace();
}
}
}
java.util.prefs.Preferences sync()
In the test program :
node created, node removed
and then sync() called - IllegalStateException not thrown.
--------------Test Program--------------------
import java.util.prefs.*;
import java.util.*;
/**
*
*SyncTest : removeNode() call and check that IllegalStateException is thrown when sync() is called
*/
public class SyncTest {
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("SyncTest() Fail");
} catch(IllegalStateException ise) {
System.out.println("Expected IllegalStateException thrown SyncTest() Pass");
} catch(Exception e) {
System.out.println("Exception thrown = " + e);
System.out.println("SyncTest() Fail");
e.printStackTrace();
}
}
}