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

java.util.prefs.Preferences sync() not throwing IllegalStateException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.4.0
    • core-libs
    • None
    • beta
    • x86
    • windows_nt
    • Verified

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

        

            jjb Josh Bloch (Inactive)
            spandeorcl Shantaram Pande (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: