java.util.prefs.Preferences getByteArray(String key, byte[] def)
After removenode() when getByteArray() is called
IllegalStateException not thrown.
Tested in jdk1.4 build 45
Test Program:
------------
import java.util.prefs.*;
import java.util.*;
/**
*
*GetByteArrayTest2: removenode() and see that IllegalStateException is thrown when getByteArray() is called.
*
*/
public class GetByteArrayTest2 {
static final int TOTAL = 10000;
static final int ARRAYSIZE = 100;
public static void main(String[] args) throws Exception {
try {
Preferences userRoot = Preferences.userRoot();
Preferences N1 = userRoot.node("N1");
byte [] value = new byte[ARRAYSIZE];
for (int i =0; i < ARRAYSIZE; i++) {
value[i]=(byte)i;
}
N1.putByteArray("k1",value);
N1.removeNode();
byte[] valuedefault = new byte[1];
valuedefault[0] = (byte)1;
byte[] valueGot = N1.getByteArray("k1",valuedefault);
System.out.println("GetByteArrayTest2 Fail");
} catch(IllegalStateException ise) {
System.out.println("Expected IllegalStateException thrown GetByteArrayTest2 Pass");
} catch(Exception e) {
System.out.println("Exception thrown = " + e);
System.out.println("GetByteArrayTest2 Fail");
e.printStackTrace();
}
}
}
After removenode() when getByteArray() is called
IllegalStateException not thrown.
Tested in jdk1.4 build 45
Test Program:
------------
import java.util.prefs.*;
import java.util.*;
/**
*
*GetByteArrayTest2: removenode() and see that IllegalStateException is thrown when getByteArray() is called.
*
*/
public class GetByteArrayTest2 {
static final int TOTAL = 10000;
static final int ARRAYSIZE = 100;
public static void main(String[] args) throws Exception {
try {
Preferences userRoot = Preferences.userRoot();
Preferences N1 = userRoot.node("N1");
byte [] value = new byte[ARRAYSIZE];
for (int i =0; i < ARRAYSIZE; i++) {
value[i]=(byte)i;
}
N1.putByteArray("k1",value);
N1.removeNode();
byte[] valuedefault = new byte[1];
valuedefault[0] = (byte)1;
byte[] valueGot = N1.getByteArray("k1",valuedefault);
System.out.println("GetByteArrayTest2 Fail");
} catch(IllegalStateException ise) {
System.out.println("Expected IllegalStateException thrown GetByteArrayTest2 Pass");
} catch(Exception e) {
System.out.println("Exception thrown = " + e);
System.out.println("GetByteArrayTest2 Fail");
e.printStackTrace();
}
}
}