Package java.util.prefs

Examples of java.util.prefs.Preferences.removeNode()


            log.error(msg, se);

            // Remove the preferences node.
            try
            {
                preferences.removeNode();
            } catch (BackingStoreException bse)
            {
                bse.printStackTrace();
            }
            throw se;
View Full Code Here


            // Remove preferences
            Preferences groupPref = Preferences.userRoot().node(
                    (String) groups[i]);
            try
            {
                groupPref.removeNode();
            } catch (BackingStoreException bse)
            {
                KeyedMessage msg =
                    SecurityException.UNEXPECTED.create("Preferences.removeNode("+groups[i]+")",
                                                        bse.getMessage());
View Full Code Here

    assertFalse(p2.isUserNode());

    p2 = new MockAbstractPreferences((AbstractPreferences) Preferences
        .userRoot(), "mock");
    assertNotSame(p2, pref);
    p2.removeNode();
  }

  public void testProtectedFields() throws BackingStoreException {
    if (!(pref instanceof MockAbstractPreferences)) {
      return;
View Full Code Here

        .publicChildSpi("child2"));

    Preferences grandchild = pref.node("child/grandchild");
    assertSame(grandchild, child.childSpi("grandchild"));
    assertSame(grandchild, child.cachedChildrenImpl()[0]);
    grandchild.removeNode();
    assertNotSame(grandchild, pref.node("child/grandchild"));

    grandchild = pref.node("child3/grandchild");
    AbstractPreferences[] childs = ((MockAbstractPreferences) pref)
        .cachedChildrenImpl();
View Full Code Here

    assertFalse(pref.nodeExists("child"));
    Preferences grandchild = pref.node("child/grandchild");
    assertTrue(pref.nodeExists("child"));
    assertTrue(pref.nodeExists("child/grandchild"));
    grandchild.removeNode();
    assertTrue(pref.nodeExists("child"));
    assertFalse(pref.nodeExists("child/grandchild"));
    assertFalse(grandchild.nodeExists(""));

    assertFalse(pref.nodeExists("child2/grandchild"));
View Full Code Here

            assertEquals(0, p.keys().length);
        } catch (BackingStoreException e) {
            // could be thrown according to specification
        }
        try {
            parent.removeNode();
        } catch (BackingStoreException e) {
            // could be thrown according to specification
        }
        try {
            p = Preferences.userNodeForPackage(null);
View Full Code Here

      Preferences.importPreferences(in);
      prefs = Preferences.userNodeForPackage(PreferencesTest.class);
    } finally {
      try {
        prefs = Preferences.userRoot().node("tests");
        prefs.removeNode();
      } catch (Exception e) {
      }
    }
  }
View Full Code Here

    p.putFloat(null, 1f);
    p.putInt(null, 1);
    p.putLong(null, 1l);
    p.remove(null);
    try {
      p.removeNode();
    } catch (BackingStoreException e2) {
    }
    p.addNodeChangeListener(null);
    p.addPreferenceChangeListener(null);
    p.removeNodeChangeListener(null);
View Full Code Here

        fail("should throw security exception");
      } catch (SecurityException e) {
      }
      try {
        // need FilePermission(delete);
        child1.removeNode();
        fail("should throw security exception");
      } catch (SecurityException e) {
      }
      try {
        uroot.childrenNames();
View Full Code Here

                            final Preferences node = root.node(string);

                            long time = node.getLong("last.pass", 0);
                            if (time < System.currentTimeMillis() - 2000) {
                                lgger.fine("Removing old node " + node.name());
                                node.removeNode();
                            }
                        }
                    } catch (BackingStoreException e1) {
                        lgger.fine("Error getting children ...");
                        e1.printStackTrace();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.