harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From regi...@apache.org
Subject svn commit: r765844 - in /harmony/enhanced/classlib/trunk/modules/prefs/src: main/java/java/util/prefs/ main/java/org/apache/harmony/prefs/internal/nls/ test/java/org/apache/harmony/prefs/tests/java/util/prefs/
Date Fri, 17 Apr 2009 03:43:51 GMT
Author: regisxu
Date: Fri Apr 17 03:43:50 2009
New Revision: 765844

URL: http://svn.apache.org/viewvc?rev=765844&view=rev
Log:
Apply patch for HARMONY-6107(with minor change): [classlib] [prefs] Refactor code in AbstractPreferences, FilePreferencesImpl, RegistryPreferencesImpl and some test cases.

Modified:
    harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java
    harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java
    harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/RegistryPreferencesImpl.java
    harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/Messages.java
    harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java
    harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesFactoryTest.java
    harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java

Modified: harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java?rev=765844&r1=765843&r2=765844&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java (original)
+++ harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java Fri Apr 17 03:43:50 2009
@@ -79,11 +79,13 @@
                 Preferences sroot = Preferences.systemRoot();
                 try {
                     uroot.flush();
-                } catch (BackingStoreException e) {//ignore
+                } catch (BackingStoreException e) {
+                    // ignore
                 }
                 try {
                     sroot.flush();
-                } catch (BackingStoreException e) {//ignore
+                } catch (BackingStoreException e) {
+                    // ignore
                 }
             }
         });
@@ -402,13 +404,13 @@
         if (key == null) {
             throw new NullPointerException();
         }
-        String result;
+        String result = null;
         synchronized (lock) {
             checkState();
             try {
                 result = getSpi(key);
             } catch (Exception e) {
-                result = null;
+                // ignored
             }
         }
         return (result == null ? deflt : result);
@@ -419,9 +421,10 @@
         String result = get(key, null);
         if (result == null) {
             return deflt;
-        } else if (result.equalsIgnoreCase("true")) { //$NON-NLS-1$
+        }
+        if ("true".equalsIgnoreCase(result)) { //$NON-NLS-1$
             return true;
-        } else if (result.equalsIgnoreCase("false")) { //$NON-NLS-1$
+        } else if ("false".equalsIgnoreCase(result)) { //$NON-NLS-1$
             return false;
         } else {
             return deflt;
@@ -437,17 +440,15 @@
         if (svalue.length() == 0) { 
             return new byte[0];
         }
-        byte[] dres;
         try {
             byte[] bavalue = svalue.getBytes("US-ASCII"); //$NON-NLS-1$
             if (bavalue.length % 4 != 0) {
                 return deflt;
             }
-            dres = Base64.decode(bavalue);
+            return Base64.decode(bavalue);
         } catch (Exception e) {
-            dres = deflt;
+            return deflt;
         }
-        return dres;
     }
 
     @Override
@@ -456,13 +457,11 @@
         if (result == null) {
             return deflt;
         }
-        double dres;
         try {
-            dres = Double.parseDouble(result);
+            return Double.parseDouble(result);
         } catch (NumberFormatException e) {
-            dres = deflt;
+            return deflt;
         }
-        return dres;
     }
 
     @Override
@@ -471,13 +470,11 @@
         if (result == null) {
             return deflt;
         }
-        float fres;
         try {
-            fres = Float.parseFloat(result);
+            return Float.parseFloat(result);
         } catch (NumberFormatException e) {
-            fres = deflt;
+            return deflt;
         }
-        return fres;
     }
 
     @Override
@@ -486,13 +483,11 @@
         if (result == null) {
             return deflt;
         }
-        int ires;
         try {
-            ires = Integer.parseInt(result);
+            return Integer.parseInt(result);
         } catch (NumberFormatException e) {
-            ires = deflt;
+            return deflt;
         }
-        return ires;
     }
 
     @Override
@@ -501,13 +496,11 @@
         if (result == null) {
             return deflt;
         }
-        long lres;
         try {
-            lres = Long.parseLong(result);
+            return Long.parseLong(result);
         } catch (NumberFormatException e) {
-            lres = deflt;
+            return deflt;
         }
-        return lres;
     }
 
     @Override
@@ -546,24 +539,22 @@
                 startNode = this;
             }
         }
-        Preferences result = null;
         try {
-            result = startNode.nodeImpl(name, true);
+            return startNode.nodeImpl(name, true);
         } catch (BackingStoreException e) {
-            //should not happen
+            // should not happen
+            return null;
         }
-        return result;
     }
 
     private void validateName(String name) {
         if (name.endsWith("/") && name.length() > 1) { //$NON-NLS-1$
             // prefs.6=Name cannot end with '/'\!
-            throw new IllegalArgumentException(Messages.getString("prefs.6"));  //$NON-NLS-1$
+            throw new IllegalArgumentException(Messages.getString("prefs.6")); //$NON-NLS-1$
         }
         if (name.indexOf("//") >= 0) { //$NON-NLS-1$
             // prefs.7=Name cannot contains consecutive '/'\!
-            throw new IllegalArgumentException(
-                    Messages.getString("prefs.7"));  //$NON-NLS-1$
+            throw new IllegalArgumentException(Messages.getString("prefs.7")); //$NON-NLS-1$
         }
     }
 
@@ -580,7 +571,6 @@
                     temp = getNodeFromBackend(createNew, currentNode, name);
                 }
             }
-
             currentNode = temp;
         }
         return currentNode;
@@ -589,12 +579,12 @@
     private AbstractPreferences getNodeFromBackend(boolean createNew,
             AbstractPreferences currentNode, String name)
             throws BackingStoreException {
-        AbstractPreferences temp;
         if (name.length() > MAX_NAME_LENGTH) {
             // prefs.8=Name length is too long: {0}
-            throw new IllegalArgumentException(Messages.getString("prefs.8",  //$NON-NLS-1$
+            throw new IllegalArgumentException(Messages.getString("prefs.8", //$NON-NLS-1$
                     name));
         }
+        AbstractPreferences temp;
         if (createNew) {
             temp = currentNode.childSpi(name);
             currentNode.cachedNode.put(name, temp);

Modified: harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java?rev=765844&r1=765843&r2=765844&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java Fri Apr 17 03:43:50 2009
@@ -64,7 +64,6 @@
                 SYSTEM_HOME = System.getProperty("java.home") + "/.systemPrefs";//$NON-NLS-1$//$NON-NLS-2$
                 return null;
             }
-
         });
     }
 
@@ -192,7 +191,8 @@
                 prefs = XMLParser.loadFilePrefs(prefsFile);
             }
             return prefs.getProperty(key);
-        } catch (Exception e) {// if Exception happened, return null
+        } catch (Exception e) {
+            // if Exception happened, return null
             return null;
         }
     }

Modified: harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/RegistryPreferencesImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/RegistryPreferencesImpl.java?rev=765844&r1=765843&r2=765844&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/RegistryPreferencesImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/RegistryPreferencesImpl.java Fri Apr 17 03:43:50 2009
@@ -109,7 +109,7 @@
     protected String getSpi(String key) {
         int[] error = new int[1];
         byte[] result = getValue(path, encodeWindowsStr(key).getBytes(), userNode, error);
-        if (error[ERROR_CODE] != 0) {
+        if (error[ERROR_CODE] != RETURN_SUCCESS) {
             return null;
         }
         return decodeWindowsStr(new String(result));

Modified: harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/Messages.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/Messages.java?rev=765844&r1=765843&r2=765844&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/Messages.java (original)
+++ harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/Messages.java Fri Apr 17 03:43:50 2009
@@ -23,7 +23,6 @@
 
 package org.apache.harmony.prefs.internal.nls;
 
-
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Locale;

Modified: harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java?rev=765844&r1=765843&r2=765844&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java Fri Apr 17 03:43:50 2009
@@ -115,28 +115,33 @@
         try {
             pref = new MockAbstractPreferences(
                     (AbstractPreferences) Preferences.userRoot(), "mo/ck");
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         try {
             pref = new MockAbstractPreferences(null, "mock");
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         try {
             new MockAbstractPreferences(null, " ");
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         try {
             new MockAbstractPreferences(pref, "");
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         try {
             new MockAbstractPreferences(pref, null);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         if (!(pref instanceof MockAbstractPreferences)) {
             return;
@@ -229,8 +234,9 @@
 
         try {
             pref.get(null, "abc");
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         pref.get("", "abc");
         pref.get("key", null);
@@ -241,21 +247,24 @@
         pref.removeNode();
         try {
             pref.get("key", "abc");
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.get(null, "abc");
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
     }
 
     public void testGetBoolean() {
         try {
             pref.getBoolean(null, false);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
 
         pref.put("testGetBooleanKey", "false");
@@ -267,28 +276,32 @@
     public void testPutByteArray() {
         try {
             pref.putByteArray(null, new byte[0]);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             pref.putByteArray("testPutByteArrayKey4", null);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
 
         pref.putByteArray(longKey, new byte[0]);
         try {
             pref.putByteArray(longKey + "a", new byte[0]);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         byte[] longArray = new byte[(int) (Preferences.MAX_VALUE_LENGTH * 0.74)];
         byte[] longerArray = new byte[(int) (Preferences.MAX_VALUE_LENGTH * 0.75) + 1];
         pref.putByteArray(longKey, longArray);
         try {
             pref.putByteArray(longKey, longerArray);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
 
         pref.putByteArray("testPutByteArrayKey", new byte[0]);
@@ -305,8 +318,9 @@
     public void testGetByteArray() throws UnsupportedEncodingException {
         try {
             pref.getByteArray(null, new byte[0]);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         byte[] b64Array = new byte[] { 0x59, 0x57, 0x4a, 0x6a };// BASE64
         // encoding for
@@ -335,8 +349,9 @@
     public void testGetDouble() {
         try {
             pref.getDouble(null, 0);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
 
         pref.put("testGetDoubleKey", "1");
@@ -352,8 +367,9 @@
     public void testGetFloat() {
         try {
             pref.getFloat(null, 0f);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         pref.put("testGetFloatKey", "1");
         pref.put("testGetFloatKey2", "value");
@@ -364,8 +380,9 @@
     public void testGetInt() {
         try {
             pref.getInt(null, 0);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
 
         pref.put("testGetIntKey", "1");
@@ -377,8 +394,9 @@
     public void testGetLong() {
         try {
             pref.getLong(null, 0);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
 
         pref.put("testGetLongKey", "1");
@@ -459,23 +477,27 @@
     public void testNode() throws BackingStoreException {
         try {
             pref.node(null);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             pref.node("/java/util/prefs/");
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         try {
             pref.node("/java//util/prefs");
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         try {
             pref.node(longName + "a");
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         assertNotNull(pref.node(longName));
 
@@ -519,18 +541,21 @@
     public void testNodeExists() throws BackingStoreException {
         try {
             pref.nodeExists(null);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             pref.nodeExists("/java/util/prefs/");
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         try {
             pref.nodeExists("/java//util/prefs");
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
 
         assertTrue(pref.nodeExists("/"));
@@ -592,51 +617,59 @@
 
         try {
             pref.put(null, "value");
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             pref.put("key", null);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         pref.put(longKey, longValue);
         try {
             pref.put(longKey + 1, longValue);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         try {
             pref.put(longKey, longValue + 1);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
 
         pref.removeNode();
         try {
             pref.put(longKey, longValue + 1);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
 
         try {
             pref.put(longKey, longValue);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
     }
 
     public void testPutBoolean() {
         try {
             pref.putBoolean(null, false);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         pref.putBoolean(longKey, false);
         try {
             pref.putBoolean(longKey + "a", false);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         pref.putBoolean("testPutBooleanKey", false);
         assertEquals("false", pref.get("testPutBooleanKey", null));
@@ -646,14 +679,16 @@
     public void testPutDouble() {
         try {
             pref.putDouble(null, 3);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         pref.putDouble(longKey, 3);
         try {
             pref.putDouble(longKey + "a", 3);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         pref.putDouble("testPutDoubleKey", 3);
         assertEquals("3.0", pref.get("testPutDoubleKey", null));
@@ -663,14 +698,16 @@
     public void testPutFloat() {
         try {
             pref.putFloat(null, 3f);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         pref.putFloat(longKey, 3f);
         try {
             pref.putFloat(longKey + "a", 3f);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         pref.putFloat("testPutFloatKey", 3f);
         assertEquals("3.0", pref.get("testPutFloatKey", null));
@@ -680,14 +717,16 @@
     public void testPutInt() {
         try {
             pref.putInt(null, 3);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         pref.putInt(longKey, 3);
         try {
             pref.putInt(longKey + "a", 3);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         pref.putInt("testPutIntKey", 3);
         assertEquals("3", pref.get("testPutIntKey", null));
@@ -697,14 +736,16 @@
     public void testPutLong() {
         try {
             pref.putLong(null, 3L);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         pref.putLong(longKey, 3L);
         try {
             pref.putLong(longKey + "a", 3L);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         pref.putLong("testPutLongKey", 3L);
         assertEquals("3", pref.get("testPutLongKey", null));
@@ -723,14 +764,17 @@
 
         try {
             pref.remove(null);
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
 
         pref.removeNode();
         try {
             pref.remove("key");
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
     }
 
@@ -843,14 +887,14 @@
 
     public void testAddPreferenceChangeListener() {
         // TODO: start from here
-
     }
 
     public void testRemoveNodeChangeListener() {
         try {
             pref.removeNodeChangeListener(null);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         MockNodeChangeListener l1 = new MockNodeChangeListener();
         MockNodeChangeListener l2 = new MockNodeChangeListener();
@@ -861,21 +905,24 @@
         pref.removeNodeChangeListener(l1);
         try {
             pref.removeNodeChangeListener(l1);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         try {
             pref.removeNodeChangeListener(l2);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
     }
 
     public void testRemovePreferenceChangeListener() {
         try {
             pref.removePreferenceChangeListener(null);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         MockPreferenceChangeListener l1 = new MockPreferenceChangeListener();
         MockPreferenceChangeListener l2 = new MockPreferenceChangeListener();
@@ -883,15 +930,17 @@
         pref.addPreferenceChangeListener(l1);
         try {
             pref.removePreferenceChangeListener(l2);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
         pref.removePreferenceChangeListener(l1);
         pref.removePreferenceChangeListener(l1);
         try {
             pref.removePreferenceChangeListener(l1);
-            fail();
+            fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
+            // Expected
         }
 
     }
@@ -1023,7 +1072,7 @@
     public void testExportNode() throws Exception {
         try {
             pref.exportNode(null);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
             // Expected
         }
@@ -1075,7 +1124,7 @@
     public void testExportSubtree() throws Exception {
         try {
             pref.exportSubtree(null);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
             // Expected
         }
@@ -1195,8 +1244,9 @@
         p.setResult(MockAbstractPreferences.backingException);
         try {
             p.childrenNames();
-            fail();
+            fail("should throw BackingStoreException");
         } catch (BackingStoreException e) {
+            // Expected
         }
         p.put("exceptionkey", "value");
         p.absolutePath();
@@ -1205,8 +1255,9 @@
         p.remove("key");
         try {
             p.clear();
-            fail();
+            fail("should throw BackingStoreException");
         } catch (BackingStoreException e) {
+            // Expected
         }
         p.putInt("key", 3);
         p.getInt("key", 3);
@@ -1222,27 +1273,31 @@
         p.getByteArray("key", new byte[0]);
         try {
             p.keys();
-            fail();
+            fail("should throw BackingStoreException");
         } catch (BackingStoreException e) {
+            // Expected
         }
 
         try {
             p.keys();
-            fail();
+            fail("should throw BackingStoreException");
         } catch (BackingStoreException e) {
+            // Expected
         }
         try {
             p.childrenNames();
-            fail();
+            fail("should throw BackingStoreException");
         } catch (BackingStoreException e) {
+            // Expected
         }
         p.parent();
         p.node("");
         p.nodeExists("");
         try {
             p.removeNode();
-            fail();
+            fail("should throw BackingStoreException");
         } catch (BackingStoreException e) {
+            // Expected
         }
         p.name();
         p.absolutePath();
@@ -1256,29 +1311,34 @@
         p.toString();
         try {
             p.sync();
-            fail();
+            fail("should throw BackingStoreException");
         } catch (BackingStoreException e) {
+            // Expected
         }
         try {
             p.flush();
-            fail();
+            fail("should throw BackingStoreException");
         } catch (BackingStoreException e) {
+            // Expected
         }
         try {
             p.exportNode(new ByteArrayOutputStream());
-            fail();
+            fail("should throw BackingStoreException");
         } catch (BackingStoreException e) {
+            // Expected
         }
         try {
             p.exportSubtree(new ByteArrayOutputStream());
-            fail();
+            fail("should throw BackingStoreException");
         } catch (BackingStoreException e) {
+            // Expected
         }
         p.isRemovedImpl();
         try {
             p.getChildImpl(null);
-            fail();
+            fail("should throw BackingStoreException");
         } catch (BackingStoreException e) {
+            // Expected
         }
         p.cachedChildrenImpl();
     }
@@ -1292,85 +1352,99 @@
         p.setResult(MockAbstractPreferences.runtimeException);
         try {
             p.childrenNames();
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         try {
             p.put("exceptionkey", "value");
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         p.absolutePath();
         p.toString();
         assertEquals("exception default", p.get("key", "exception default"));
         try {
             p.remove("key");
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         try {
             p.clear();
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         try {
             p.putInt("key", 3);
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         p.getInt("key", 3);
         try {
             p.putLong("key", 3l);
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         p.getLong("key", 3l);
         try {
             p.putDouble("key", 3);
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         p.getDouble("key", 3);
         try {
             p.putBoolean("key", true);
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         p.getBoolean("key", true);
         try {
             p.putFloat("key", 3f);
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         p.getFloat("key", 3f);
         try {
             p.putByteArray("key", new byte[0]);
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         p.getByteArray("key", new byte[0]);
         try {
             p.keys();
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         try {
             p.keys();
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         try {
             p.childrenNames();
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         p.parent();
         p.node("");
         p.nodeExists("");
         try {
             p.removeNode();
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         p.name();
         p.absolutePath();
@@ -1384,29 +1458,34 @@
         p.toString();
         try {
             p.sync();
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         try {
             p.flush();
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         try {
             p.exportNode(new ByteArrayOutputStream());
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         try {
             p.exportSubtree(new ByteArrayOutputStream());
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         p.isRemovedImpl();
         try {
             p.getChildImpl(null);
-            fail();
+            fail("should throw MockRuntimeException");
         } catch (MockRuntimeException e) {
+            // Expected
         }
         p.cachedChildrenImpl();
     }
@@ -1419,8 +1498,9 @@
         p.setResult(MockAbstractPreferences.returnNull);
         try {
             p.childrenNames();
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         p.absolutePath();
         p.toString();
@@ -1429,8 +1509,9 @@
         p.remove("key");
         try {
             p.clear();
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         p.putInt("key", 3);
         p.getInt("key", 3);
@@ -1447,16 +1528,18 @@
         p.keys();
         try {
             p.childrenNames();
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         p.parent();
         p.node("");
         p.nodeExists("");
         try {
             p.removeNode();
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         p.name();
         p.absolutePath();
@@ -1472,19 +1555,22 @@
         p.flush();
         try {
             p.exportNode(System.out);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.exportSubtree(System.out);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         p.isRemovedImpl();
         try {
             p.getChildImpl("");
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         p.cachedChildrenImpl();
     }
@@ -1506,160 +1592,191 @@
         pref.flush();
         try {
             pref.nodeExists("child");
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.childrenNames();
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.remove(null);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.clear();
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.get("key", "null default");
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.put("nullkey", "value");
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.putInt("key", 3);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.getInt("key", 3);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.putLong("key", 3l);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.getLong("key", 3l);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.putDouble("key", 3);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.getDouble("key", 3);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.putBoolean("key", true);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.getBoolean("key", true);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.putFloat("key", 3f);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.getFloat("key", 3f);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.putByteArray("key", new byte[0]);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.getByteArray("key", new byte[0]);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.keys();
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.keys();
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.childrenNames();
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.parent();
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.node(null);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.removeNode();
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref
-            .addPreferenceChangeListener(new MockPreferenceChangeListener());
-            fail();
+                    .addPreferenceChangeListener(new MockPreferenceChangeListener());
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref
-            .removePreferenceChangeListener(new MockPreferenceChangeListener());
-            fail();
+                    .removePreferenceChangeListener(new MockPreferenceChangeListener());
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.addNodeChangeListener(new MockNodeChangeListener());
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.removeNodeChangeListener(new MockNodeChangeListener());
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.sync();
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.exportNode(null);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             pref.exportSubtree(null);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         if (!(pref instanceof MockAbstractPreferences)) {
             return;
@@ -1669,8 +1786,9 @@
         p.cachedChildrenImpl();
         try {
             p.getChildImpl(null);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
     }
 
@@ -1682,93 +1800,111 @@
         p.removeNode();
         try {
             p.get(null, "null default");
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.put(null, "value");
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.putInt(null, 3);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.getInt(null, 3);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.putLong(null, 3l);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.getLong(null, 3l);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.putDouble(null, 3);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.getDouble(null, 3);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.putBoolean(null, true);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.getBoolean(null, true);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.putFloat(null, 3f);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.getFloat(null, 3f);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.putByteArray(null, new byte[0]);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.getByteArray(null, new byte[0]);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.addPreferenceChangeListener(null);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.removePreferenceChangeListener(null);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
         try {
             p.addNodeChangeListener(null);
-            fail();
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
         try {
             p.removeNodeChangeListener(null);
-            fail();
+            fail("should throw IllegalStateException");
         } catch (IllegalStateException e) {
+            // Expected
         }
     }
 
@@ -1866,4 +2002,3 @@
     }
 
 }
-

Modified: harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesFactoryTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesFactoryTest.java?rev=765844&r1=765843&r2=765844&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesFactoryTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesFactoryTest.java Fri Apr 17 03:43:50 2009
@@ -38,11 +38,11 @@
     }
 
     public void testUserRoot() {
-        f.userRoot();
+        assertNull(f.userRoot());
     }
 
     public void testSystemRoot() {
-        f.systemRoot();
+        assertNull(f.systemRoot());
     }
 
     public static class PreferencesFactoryImpl implements PreferencesFactory {

Modified: harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java?rev=765844&r1=765843&r2=765844&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/PreferencesTest.java Fri Apr 17 03:43:50 2009
@@ -77,26 +77,15 @@
         assertEquals("lang", p.name());
         assertEquals("System Preference Node: " + p.absolutePath(), p
                 .toString());
+
+        assertEquals(0, p.childrenNames().length);
+        assertEquals(0, p.keys().length);
+        parent.removeNode();
         try {
-            assertEquals(0, p.childrenNames().length);
-        } catch (BackingStoreException e) {
-            // could be thrown according to specification
-        }
-        try {
-            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);
-            fail("NullPointerException has not been thrown");
+            Preferences.userNodeForPackage(null);
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
-            // expected
+            // Expected
         }
     }
 
@@ -109,8 +98,6 @@
         assertEquals("", p.name());
         assertEquals("System Preference Node: " + p.absolutePath(), p
                 .toString());
-        // assertEquals(0, p.childrenNames().length);
-        // assertEquals(0, p.keys().length);
     }
 
     public void testConsts() {
@@ -133,9 +120,10 @@
         assertEquals(0, p.keys().length);
 
         try {
-            p = Preferences.userNodeForPackage(null);
-            fail();
+            Preferences.userNodeForPackage(null);
+            fail("should throw NullPointerException");
         } catch (NullPointerException e) {
+            // Expected
         }
     }
 
@@ -147,8 +135,6 @@
         assertTrue(p.isUserNode());
         assertEquals("", p.name());
         assertEquals("User Preference Node: " + p.absolutePath(), p.toString());
-        // assertEquals(0, p.childrenNames().length);
-        // assertEquals(p.keys().length, 0);
     }
 
     public void testImportPreferences() throws Exception {
@@ -160,7 +146,8 @@
 
             prefs.put("prefskey", "oldvalue");
             prefs.put("prefskey2", "oldvalue2");
-            in = PreferencesTest.class.getResourceAsStream("/prefs/java/util/prefs/userprefs.xml");
+            in = PreferencesTest.class
+                    .getResourceAsStream("/prefs/java/util/prefs/userprefs.xml");
             Preferences.importPreferences(in);
 
             prefs = Preferences.userNodeForPackage(PreferencesTest.class);
@@ -171,39 +158,43 @@
             assertEquals("newvalue3", prefs.get("prefskey3", null));
 
             in = PreferencesTest.class
-            .getResourceAsStream("/prefs/java/util/prefs/userprefs-badform.xml");
+                    .getResourceAsStream("/prefs/java/util/prefs/userprefs-badform.xml");
             try {
                 Preferences.importPreferences(in);
-                fail();
+                fail("should throw InvalidPreferencesFormatException");
             } catch (InvalidPreferencesFormatException e) {
+                // Expected
             }
 
             in = PreferencesTest.class
-            .getResourceAsStream("/prefs/java/util/prefs/userprefs-badtype.xml");
+                    .getResourceAsStream("/prefs/java/util/prefs/userprefs-badtype.xml");
             try {
                 Preferences.importPreferences(in);
-                fail();
+                fail("should throw InvalidPreferencesFormatException");
             } catch (InvalidPreferencesFormatException e) {
+                // Expected
             }
 
             in = PreferencesTest.class
-            .getResourceAsStream("/prefs/java/util/prefs/userprefs-badencoding.xml");
+                    .getResourceAsStream("/prefs/java/util/prefs/userprefs-badencoding.xml");
             try {
                 Preferences.importPreferences(in);
-                fail();
+                fail("should throw InvalidPreferencesFormatException");
             } catch (InvalidPreferencesFormatException e) {
+                // Expected
             }
 
             in = PreferencesTest.class
-            .getResourceAsStream("/prefs/java/util/prefs/userprefs-higherversion.xml");
+                    .getResourceAsStream("/prefs/java/util/prefs/userprefs-higherversion.xml");
             try {
                 Preferences.importPreferences(in);
-                fail();
+                fail("should throw InvalidPreferencesFormatException");
             } catch (InvalidPreferencesFormatException e) {
+                // Expected
             }
 
             in = PreferencesTest.class
-            .getResourceAsStream("/prefs/java/util/prefs/userprefs-ascii.xml");
+                    .getResourceAsStream("/prefs/java/util/prefs/userprefs-ascii.xml");
             Preferences.importPreferences(in);
             prefs = Preferences.userNodeForPackage(PreferencesTest.class);
         } finally {
@@ -211,6 +202,7 @@
                 prefs = Preferences.userRoot().node("tests");
                 prefs.removeNode();
             } catch (Exception e) {
+                // Ignored
             }
         }
     }
@@ -218,30 +210,34 @@
     public void testImportPreferencesException() throws Exception {
         try {
             Preferences.importPreferences(null);
-            fail();
+            fail("should throw MalformedURLException");
         } catch (MalformedURLException e) {
+            // Expected
         }
 
         byte[] source = new byte[0];
         InputStream in = new ByteArrayInputStream(source);
         try {
             Preferences.importPreferences(in);
-            fail();
+            fail("should throw InvalidPreferencesFormatException");
         } catch (InvalidPreferencesFormatException e) {
+            // Expected
         }
 
         stream.setResult(MockInputStream.exception);
         try {
             Preferences.importPreferences(stream);
-            fail();
+            fail("should throw IOException");
         } catch (IOException e) {
+            // Expected
         }
 
         stream.setResult(MockInputStream.runtimeException);
         try {
             Preferences.importPreferences(stream);
-            fail();
+            fail("should throw RuntimeException");
         } catch (RuntimeException e) {
+            // Expected
         }
     }
 
@@ -251,103 +247,41 @@
             manager.install();
             try {
                 Preferences.userRoot();
-                fail();
+                fail("should throw SecurityException");
             } catch (SecurityException e) {
+                // Expected
             }
             try {
                 Preferences.systemRoot();
-                fail();
+                fail("should throw SecurityException");
             } catch (SecurityException e) {
+                // Expected
             }
             try {
                 Preferences.userNodeForPackage(null);
-                fail();
+                fail("should throw SecurityException");
             } catch (SecurityException e) {
+                // Expected
             }
 
             try {
                 Preferences.systemNodeForPackage(null);
-                fail();
+                fail("should throw SecurityException");
             } catch (SecurityException e) {
+                // Expected
             }
 
             try {
                 Preferences.importPreferences(stream);
-                fail();
+                fail("should throw SecurityException");
             } catch (SecurityException e) {
+                // Expected
             }
         } finally {
             manager.restoreDefault();
         }
     }
 
-    public void testAbstractMethods() {
-        Preferences p = new MockPreferences();
-        p.absolutePath();
-        try {
-            p.childrenNames();
-        } catch (BackingStoreException e4) {
-        }
-        try {
-            p.clear();
-        } catch (BackingStoreException e5) {
-        }
-        try {
-            p.exportNode(null);
-        } catch (IOException e6) {
-        } catch (BackingStoreException e6) {
-        }
-        try {
-            p.exportSubtree(null);
-        } catch (IOException e7) {
-        } catch (BackingStoreException e7) {
-        }
-        try {
-            p.flush();
-        } catch (BackingStoreException e8) {
-        }
-        p.get(null, null);
-        p.getBoolean(null, false);
-        p.getByteArray(null, null);
-        p.getFloat(null, 0.1f);
-        p.getDouble(null, 0.1);
-        p.getInt(null, 1);
-        p.getLong(null, 1l);
-        p.isUserNode();
-        try {
-            p.keys();
-        } catch (BackingStoreException e) {
-        }
-        p.name();
-        p.node(null);
-        try {
-            p.nodeExists(null);
-        } catch (BackingStoreException e1) {
-        }
-        p.parent();
-        p.put(null, null);
-        p.putBoolean(null, false);
-        p.putByteArray(null, null);
-        p.putDouble(null, 1);
-        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);
-        p.removePreferenceChangeListener(null);
-        try {
-            p.sync();
-        } catch (BackingStoreException e3) {
-        }
-        p.toString();
-    }
-
     static class MockInputStream extends InputStream {
 
         static final int normal = 0;



Mime
View raw message