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

java.util.prefs: removeNode() / removeNodeSpi(): Node is permanently removed even when no flush() is invoked

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_74"
      Java(TM) SE Runtime Environment (build 1.8.0_74-b02) Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux hp-elitebook-840-g1--s0-v1.becke.ch 4.2.0-27-generic #32-Ubuntu SMP Fri Jan 22 04:49:08 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      When running the first time:
      public static void main(String[] args) throws BackingStoreException {
      Preferences userRoot = Preferences.userRoot();
      Preferences a = userRoot.node("a");
      System.out.println(a.nodeExists("a1"));
      Preferences a1 = a.node("a1");
      a.flush();
      a1.removeNode();
      }
      Then the output for " System.out.println(a.nodeExists("a1"))" is "false"
      When running the program a second time then the output should be "true" because the node was removed after flushing:
      https://docs.oracle.com/javase/8/docs/api/java/util/prefs/AbstractPreferences.html
      removeNodeSpi(): … The removal of a node needn't become persistent until the flush method is invoked on this node (or an ancestor)…
      BUT the output is "false" and this is wrong see the SPI specification.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      When running the first time:
      public static void main(String[] args) throws BackingStoreException {
      Preferences userRoot = Preferences.userRoot();
      Preferences a = userRoot.node("a");
      System.out.println(a.nodeExists("a1"));
      Preferences a1 = a.node("a1");
      a.flush();
      a1.removeNode();
      }
      Then the output for " System.out.println(a.nodeExists("a1"))" is "false"
      When running the program a second time then the output should be "true" because the node was removed after flushing:
      https://docs.oracle.com/javase/8/docs/api/java/util/prefs/AbstractPreferences.html
      removeNodeSpi(): … The removal of a node needn't become persistent until the flush method is invoked on this node (or an ancestor)…
      BUT the output is "false" and this is wrong see the SPI specification.


      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Activity

            People

            • Assignee:
              bpb Brian Burkhalter
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: