Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4399789

java.util.prefs.Preferences getByteArray(String key, byte[] def)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • core-libs
    • None
    • merlin
    • x86
    • windows_nt
    • Verified

      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();
             }
          }
       
       }


         
        

            kkladkosunw Konstantin Kladko (Inactive)
            spandeorcl Shantaram Pande (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: