harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r472454 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/Introspector.java test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
Date Wed, 08 Nov 2006 11:38:35 GMT
Author: ayza
Date: Wed Nov  8 03:38:34 2006
New Revision: 472454

URL: http://svn.apache.org/viewvc?view=rev&rev=472454
Log:
Fix for HARMONY-2001 ([classlib][beans] problems with Introspector.decapitalize)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Introspector.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Introspector.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Introspector.java?view=diff&rev=472454&r1=472453&r2=472454
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Introspector.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Introspector.java
Wed Nov  8 03:38:34 2006
@@ -36,16 +36,20 @@
 
     public static String decapitalize(String name) {
         if ((name != null) && (name.length() > 0)) {
+            String result;
+            
             // first two letters are capital
             if ((name.length() > 1)
-                    && name.substring(0, 2).equals(
-                            name.substring(0, 2).toUpperCase())) {
+                    && Character.isUpperCase(name.charAt(0))
+                    && Character.isUpperCase(name.charAt(1))) {
                 return name;
             }
-            String result = name.substring(0, 1).toLowerCase();
+            
+            result = name.substring(0, 1).toLowerCase();
             if (name.length() > 1) {
                 result += name.substring(1);
             }
+            
             return result;
         }
         return name;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java?view=diff&rev=472454&r1=472453&r2=472454
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
Wed Nov  8 03:38:34 2006
@@ -296,7 +296,7 @@
         assertEquals("x", Introspector.decapitalize("X"));
         assertNull(Introspector.decapitalize(null));
         assertEquals("", Introspector.decapitalize(""));
-
+        assertEquals("a1", Introspector.decapitalize("A1"));
     }
 
     public void testFlushCaches() throws IntrospectionException {



Mime
View raw message