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

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 1.4.0
    • Affects Version/s: 1.4.0
    • Component/s: core-libs
    • None
    • merlin
    • x86
    • windows_nt
    • Verified

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

      NullPointerException not thrown when key =null

      Test program :
      -------------
       
      import java.util.prefs.*;
      import java.util.*;
       

      public class GetByteArrayTest {
          public static void main(String[] args) throws Exception {
         
            try {
                 Preferences userRoot = Preferences.userRoot();
                 Preferences N1 = userRoot.node("N1");
                 N1.clear();
                
                 byte [] value = new byte[1];
                 value[0]=(byte)2;
                 N1.putByteArray("k1",value);
                 byte[] valueExpected = value;
                 byte[] valuedefault = new byte[1];
                 valuedefault[0] = (byte)0;
                 byte[] valueGot = N1.getByteArray(null,valuedefault);
                 System.out.println("NullPointerException not thrown valueGot[0] = " + valueGot[0]);
            } catch(NullPointerException npe) {
                System.out.println("Expected NullPointerException thrown = " + npe);
                System.out.println("GetByteArrayTestTest02() Pass");
            } catch(Exception e) {
                System.out.println("Exception thrown = " + e);
                System.out.println("GetByteArrayTestTest02() Fail");
                e.printStackTrace();
            }
          }
       
      }

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: