harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r423014 - in /incubator/harmony/enhanced/classlib/trunk/modules/prefs/src: main/java/java/util/prefs/AbstractPreferences.java test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java
Date Tue, 18 Jul 2006 08:48:30 GMT
Author: pyang
Date: Tue Jul 18 01:48:29 2006
New Revision: 423014

URL: http://svn.apache.org/viewvc?rev=423014&view=rev
Log:
Fix for HARMONY-828 (Preferences.nodeExists() throws IllegalArgumentException on a long path)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java?rev=423014&r1=423013&r2=423014&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java
Tue Jul 18 01:48:29 2006
@@ -1,4 +1,4 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 2005, 2006 The Apache Software Foundation or its licensors, as applicable
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -668,8 +668,12 @@
                 startNode = this;
             }
         }
-        Preferences result = startNode.nodeImpl(name, false);
-        return null == result ? false : true;
+        try {
+            Preferences result = startNode.nodeImpl(name, false);
+            return null == result ? false : true;
+        } catch(IllegalArgumentException e) {
+            return false;
+        }
     }
 
     /*

Modified: incubator/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/incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java?rev=423014&r1=423013&r2=423014&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java
Tue Jul 18 01:48:29 2006
@@ -1,4 +1,4 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 2005, 2006 The Apache Software Foundation or its licensors, as applicable
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -1762,6 +1762,13 @@
 		}
 	}
 
+    /**
+     * Regression for HARMONY-828
+     */
+    public void testLongPath() throws Exception { 
+        assertFalse(pref.nodeExists("ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"));
+    } 
+
 	public static class MockPreferenceChangeListener implements
 			PreferenceChangeListener {
 		private int changed = 0;
@@ -1847,5 +1854,6 @@
 			removed = 0;
 		}
 	}
+
 }
 



Mime
View raw message