harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r440707 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/ main/java/org/apache/harmony/beans/editors/ test/java/org/apache/harmony/beans/tests/java/beans/ test/support/java/org/apache/harmony/beans/tes...
Date Wed, 06 Sep 2006 12:54:31 GMT
Author: mloenko
Date: Wed Sep  6 05:54:30 2006
New Revision: 440707

URL: http://svn.apache.org/viewvc?view=rev&rev=440707
Log:
applied patch for HARMONY-1199
[classlib][beans] Default Propery Editor for java.lang.String class throws IllegalArgumentException

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorManagerRegressionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/StringEditor.java
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorManager.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/editors/StringEditor.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorManager.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorManager.java?view=diff&rev=440707&r1=440706&r2=440707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorManager.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorManager.java
Wed Sep  6 05:54:30 2006
@@ -96,9 +96,8 @@
                     try {
                         editorClass = Class.forName(editorClassName, true,
                                 loader);
-                    } catch (ClassNotFoundException cnfe2) {} catch (Exception e) {
                         break;
-                    }
+                    } catch (Exception e) {}
                 }
             } catch (Exception e) {}
         }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/editors/StringEditor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/editors/StringEditor.java?view=diff&rev=440707&r1=440706&r2=440707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/editors/StringEditor.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/editors/StringEditor.java
Wed Sep  6 05:54:30 2006
@@ -42,4 +42,8 @@
     public StringEditor() {
         super();
     }
+    
+    public void setAsText(String text){
+        setValue(text);
+    }
 }

Added: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorManagerRegressionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorManagerRegressionTest.java?view=auto&rev=440707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorManagerRegressionTest.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorManagerRegressionTest.java
Wed Sep  6 05:54:30 2006
@@ -0,0 +1,73 @@
+/* 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.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.beans.tests.java.beans;
+
+import java.beans.*;
+import junit.framework.TestCase;
+import org.apache.harmony.beans.tests.support.StringEditor;
+
+/**
+ * Regression test for PropertyEditorManager
+ */
+public class PropertyEditorManagerRegressionTest extends TestCase {
+
+    static String origPath[] = PropertyEditorManager.getEditorSearchPath();
+
+    public void testFindEditorAccordingPath_1() throws Exception {
+        // Regression Harmony-1205
+        String newPath[] = new String[origPath.length + 1];
+        newPath[0] = "org.apache.harmony.beans.tests.support";
+        for (int i = 0; i < origPath.length; i++) {
+            newPath[i + 1] = origPath[i];
+        }
+
+        PropertyEditorManager.setEditorSearchPath(newPath);
+
+        PropertyEditor editor = PropertyEditorManager.findEditor(Class
+                .forName("java.lang.String"));
+
+        assertEquals(org.apache.harmony.beans.tests.support.StringEditor.class,
+                editor.getClass());
+    }
+
+    public void testFindEditorAccordingPath_2() throws Exception {
+        // Regression Harmony-1205
+        String newPath[] = new String[origPath.length + 1];
+        newPath[origPath.length] = "org.apache.harmony.beans.tests.support";
+        for (int i = 0; i < origPath.length; i++) {
+            newPath[i] = origPath[i];
+        }
+
+        PropertyEditorManager.setEditorSearchPath(newPath);
+
+        PropertyEditor editor = PropertyEditorManager.findEditor(Class
+                .forName("java.lang.String"));
+
+        assertEquals(org.apache.harmony.beans.editors.StringEditor.class,
+                editor.getClass());
+    }
+
+    public void testStringEditor() throws Exception {
+        // Regression Harmony-1199
+        PropertyEditorManager.setEditorSearchPath(origPath);
+        PropertyEditor editor = PropertyEditorManager.findEditor(Class
+                .forName("java.lang.String"));
+        String text = "A sample string";
+
+        editor.setAsText(text);
+        assertEquals(text, editor.getAsText());
+    }
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/StringEditor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/StringEditor.java?view=auto&rev=440707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/StringEditor.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/StringEditor.java
Wed Sep  6 05:54:30 2006
@@ -0,0 +1,34 @@
+/*
+ *  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.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.beans.tests.support;
+
+import java.beans.*;
+
+public class StringEditor extends PropertyEditorSupport {
+
+    public StringEditor(final Object source) {
+        super(source);
+    }
+
+    public StringEditor() {
+        super();
+    }
+
+    public void setAsText(String text) {
+        setValue(text);
+    }
+}



Mime
View raw message