Package java.util.prefs

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


                try {
                    versions.store(fos, "Database versions");
                } finally {
                    Util.closeStream(fos);
                }
                p.removeNode();
            }
        }

        // Load the database versions
        if (versions == null) {
View Full Code Here


                if (option == 1) {
                    boolean success = true;
                    try {
                        Preferences root = Preferences.userRoot();
                        Preferences node = root.node("/com/lightcrafts");
                        node.removeNode();
                    }
                    catch (BackingStoreException e) {
                        System.err.println(
                            "StartupCrash failed to reset Preferences"
                        );
View Full Code Here

            try {
                // On Linux, the license state resides in preferences.
                Object licenseState = DummyLicenseLibrary.getLicenseState();
                Preferences root = Preferences.userRoot();
                Preferences node = root.node("/com/lightcrafts");
                node.removeNode();
                node.flush();
                if (licenseState != null) {
                    DummyLicenseLibrary.setLicenseState(licenseState);
                }
            }
View Full Code Here

      }
     
      for( Iterator iter = setDirtyConfigs[ id ].iterator(); iter.hasNext(); ) {
        cfgID = (String) iter.next();
        cfgPrefs = ocPrefs.node(cfgID );
        cfgPrefs.removeNode();
//System.err.println( "removing "+cfgID );
      }
     
      ocPrefs.flush();
    }
View Full Code Here

    }
    // Hack to get Base64-encoded credentials
    Preferences tempNode = Preferences.userRoot().node("xxx");
    tempNode.putByteArray("xxx", url.getUserInfo().getBytes());
    String authInfo = tempNode.get("xxx", null);
    tempNode.removeNode();
    //
    sslContext.init(null, new TrustManager[] { new TrustEveryone() }, null);
    HttpsURLConnection urlConnection = (HttpsURLConnection) url.openConnection();
//    HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
    urlConnection.setRequestProperty("User-Agent", "jhg/0.1.0");
View Full Code Here

    try {
      // Hack to get Base64-encoded credentials
      Preferences tempNode = Preferences.userRoot().node("xxx");
      tempNode.putByteArray("xxx", String.format("%s:%s", username, password).getBytes());
      ai = tempNode.get("xxx", null);
      tempNode.removeNode();
    } catch (BackingStoreException ex) {
      ctx.getLog().dump(getClass(), Info, ex, null);
      // IGNORE
    }
    return ai;
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

            Preferences.importPreferences(in);
            prefs = Preferences.userNodeForPackage(PreferencesTest.class);
        } finally {
            try {
                prefs = Preferences.userRoot().node("tests");
                prefs.removeNode();
            } catch (Exception e) {
                // Ignored
            }
        }
    }
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.