harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r693864 - in /harmony/enhanced/classlib/trunk: modules/awt/src/main/java/common/java/awt/ modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/ modules/awt/src/test/impl/boot/java/awt/ modules/beans/src/main/java/java/beans/ modu...
Date Wed, 10 Sep 2008 14:56:59 GMT
Author: hindessm
Date: Wed Sep 10 07:56:56 2008
New Revision: 693864

URL: http://svn.apache.org/viewvc?rev=693864&view=rev
Log:
Use more efficient String.indexOf(int) rather than String.indexOf(String)
where possible.

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MenuComponent.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/impl/boot/java/awt/Tools.java
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSName.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Provider.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Security.java
    harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Security2Test.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/plaf/basic/BasicTextUITest.java
    harmony/enhanced/classlib/trunk/support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java?rev=693864&r1=693863&r2=693864&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java
Wed Sep 10 07:56:56 2008
@@ -1047,11 +1047,11 @@
 
     String autoName() {
         String name = getClass().getName();
-        if (name.indexOf("$") != -1) { //$NON-NLS-1$
+        if (name.indexOf('$') != -1) {
             return null;
         }
         int number = toolkit.autoNumber.nextComponent++;
-        name = name.substring(name.lastIndexOf(".") + 1) + Integer.toString(number); //$NON-NLS-1$
+        name = name.substring(name.lastIndexOf('.') + 1) + Integer.toString(number);
         return name;
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MenuComponent.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MenuComponent.java?rev=693864&r1=693863&r2=693864&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MenuComponent.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MenuComponent.java
Wed Sep 10 07:56:56 2008
@@ -806,11 +806,11 @@
 
     String autoName() {
         String name = getClass().getName();
-        if (name.indexOf("$") != -1) { //$NON-NLS-1$
+        if (name.indexOf('$') != -1) {
             return null;
         }
         int number = toolkit.autoNumber.nextMenuComponent++;
-        name = name.substring(name.lastIndexOf(".") + 1) + Integer.toString(number); //$NON-NLS-1$
+        name = name.substring(name.lastIndexOf('.') + 1) + Integer.toString(number);
         return name;
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java?rev=693864&r1=693863&r2=693864&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java
Wed Sep 10 07:56:56 2008
@@ -341,7 +341,7 @@
      * @param faceName logical font face name
      */
     public String getFamilyFromLogicalFace(String faceName){
-        int pos = faceName.indexOf("."); //$NON-NLS-1$
+        int pos = faceName.indexOf('.');
         if (pos == -1){
             return faceName;
         }
@@ -462,7 +462,7 @@
     public String getLogicalFaceFromFont(int fontStyle, int logicalIndex){
         int style = 0;
         String name = LOGICAL_FONT_FACES[logicalIndex];
-        int pos = name.indexOf("."); //$NON-NLS-1$
+        int pos = name.indexOf('.');
         
         if (pos == -1){
             return createLogicalFace(name, fontStyle);
@@ -485,7 +485,7 @@
      */
     public int getStyleFromLogicalFace(String name){
         int style;
-        int pos = name.indexOf("."); //$NON-NLS-1$
+        int pos = name.indexOf('.');
         
         if (pos == -1){
             return Font.PLAIN;

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/impl/boot/java/awt/Tools.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/impl/boot/java/awt/Tools.java?rev=693864&r1=693863&r2=693864&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/impl/boot/java/awt/Tools.java (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/impl/boot/java/awt/Tools.java Wed
Sep 10 07:56:56 2008
@@ -459,14 +459,14 @@
     public static class File {
 
         public static String changeExt(String file, String newExt) {
-            int k = file.lastIndexOf(".");
+            int k = file.lastIndexOf('.');
             return file.substring(0, k) + newExt;
         }
 
         public static String extractFileName(String file) {
             int k;
-            if ((k = file.lastIndexOf("/")) == -1) {
-                if ((k = file.lastIndexOf("\\")) == -1) {
+            if ((k = file.lastIndexOf('/')) == -1) {
+                if ((k = file.lastIndexOf('\\')) == -1) {
                     k = 1;
                 }
             }
@@ -474,7 +474,7 @@
         }
 
         public static String extractFileExt(String file) {
-            int k = file.lastIndexOf(".");
+            int k = file.lastIndexOf('.');
             return file.substring(k + 1);
         }
 

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java?rev=693864&r1=693863&r2=693864&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java
Wed Sep 10 07:56:56 2008
@@ -104,7 +104,7 @@
 
         if (leguminaClass != null) {
             String beanClassName = leguminaClass.getName();
-            int idx = beanClassName.lastIndexOf("."); //$NON-NLS-1$
+            int idx = beanClassName.lastIndexOf('.');
 
             result = (idx == -1) ? beanClassName : beanClassName
                     .substring(idx + 1);

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java?rev=693864&r1=693863&r2=693864&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java
Wed Sep 10 07:56:56 2008
@@ -342,7 +342,7 @@
             throws IntrospectionException {
         String expectedListenerTypeName = listenerType.getName();
         expectedListenerTypeName = expectedListenerTypeName
-                .substring(expectedListenerTypeName.lastIndexOf(".") + 1); //$NON-NLS-1$
+                .substring(expectedListenerTypeName.lastIndexOf('.') + 1);
         Method method = null;
         Method[] methods = sourceClass.getMethods();
         for (Method m : methods) {

Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSName.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSName.java?rev=693864&r1=693863&r2=693864&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSName.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/DNSName.java
Wed Sep 10 07:56:56 2008
@@ -431,7 +431,7 @@
      * @return <code>true</code> or <code>false</code>
      */
     static boolean componentIsOk(String comp) {
-        if (comp.indexOf(".") != -1 || comp.length() > //$NON-NLS-1$
+        if (comp.indexOf('.') != -1 || comp.length() >
                 ProviderConstants.LABEL_MAX_CHARS) {
             return false;
         }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java?rev=693864&r1=693863&r2=693864&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
Wed Sep 10 07:56:56 2008
@@ -2523,7 +2523,7 @@
     }
 
     private static String getBaseName(String fullName) {
-        int k = fullName.lastIndexOf("."); //$NON-NLS-1$
+        int k = fullName.lastIndexOf('.');
 
         if (k == -1 || k == (fullName.length() - 1)) {
             return fullName;

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java?rev=693864&r1=693863&r2=693864&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
Wed Sep 10 07:56:56 2008
@@ -39,11 +39,11 @@
     }
 
     public boolean isPredictableSourceFileName(String className, String sourceFileName) {
-        if (className.indexOf(".") != -1) {
-            className = className.substring(className.lastIndexOf(".") + 1);
+        if (className.indexOf('.') != -1) {
+            className = className.substring(className.lastIndexOf('.') + 1);
         }
-        if (className.indexOf("$") != -1) {
-            className = className.substring(0, className.indexOf("$"));
+        if (className.indexOf('$') != -1) {
+            className = className.substring(0, className.indexOf('$'));
         }
         className += ".java";
         return className.equals(sourceFileName);

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Provider.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Provider.java?rev=693864&r1=693863&r2=693864&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Provider.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Provider.java
Wed Sep 10 07:56:56 2008
@@ -530,7 +530,7 @@
         if (k.startsWith("Alg.Alias.")) { // Alg.Alias.<crypto_service>.<aliasName>=<standardName>
//$NON-NLS-1$
             String aliasName;
             String service_alias = k.substring(10);
-            i = service_alias.indexOf("."); //$NON-NLS-1$
+            i = service_alias.indexOf('.');
             serviceName = service_alias.substring(0, i);
             aliasName = service_alias.substring(i + 1);
             if (propertyAliasTable != null) {
@@ -548,12 +548,12 @@
             }
             return;
         }
-        int j = k.indexOf("."); //$NON-NLS-1$
+        int j = k.indexOf('.');
         if (j == -1) { // unknown format
             return;
         }
 
-        i = k.indexOf(" "); //$NON-NLS-1$
+        i = k.indexOf(' ');
         if (i == -1) { // <crypto_service>.<algorithm_or_type>=<className>
             serviceName = k.substring(0, j);
             algorithm = k.substring(j + 1);
@@ -610,7 +610,7 @@
             if (key.startsWith("Alg.Alias.")) { // Alg.Alias.<crypto_service>.<aliasName>=<standardName>
//$NON-NLS-1$
                 String aliasName;
                 String service_alias = key.substring(10);
-                i = service_alias.indexOf("."); //$NON-NLS-1$
+                i = service_alias.indexOf('.');
                 serviceName = service_alias.substring(0, i);
                 aliasName = service_alias.substring(i + 1);
                 algorithm = value;
@@ -647,11 +647,11 @@
                 }
                 continue;
             }
-            int j = key.indexOf("."); //$NON-NLS-1$
+            int j = key.indexOf('.');
             if (j == -1) { // unknown format
                 continue;
             }
-            i = key.indexOf(" "); //$NON-NLS-1$
+            i = key.indexOf(' ');
             if (i == -1) { // <crypto_service>.<algorithm_or_type>=<className>
                 serviceName = key.substring(0, j);
                 algorithm = key.substring(j + 1);

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Security.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Security.java?rev=693864&r1=693863&r2=693864&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Security.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Security.java
Wed Sep 10 07:56:56 2008
@@ -259,7 +259,7 @@
                     Messages.getString("security.2B")); //$NON-NLS-1$
         }
         HashMap<String, String> hm = new HashMap<String, String>();
-        int i = filter.indexOf(":"); //$NON-NLS-1$
+        int i = filter.indexOf(':');
         if ((i == filter.length() - 1) || (i == 0)) {
             throw new InvalidParameterException(
                     Messages.getString("security.2B")); //$NON-NLS-1$
@@ -291,8 +291,8 @@
             String key = (String) entry.getKey();
             String val = (String) entry.getValue();
             String attribute = null;
-            int i = key.indexOf(" "); //$NON-NLS-1$
-            int j = key.indexOf("."); //$NON-NLS-1$
+            int i = key.indexOf(' ');
+            int j = key.indexOf('.');
             if (j == -1) {
                 throw new InvalidParameterException(
                         Messages.getString("security.2B")); //$NON-NLS-1$

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Security2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Security2Test.java?rev=693864&r1=693863&r2=693864&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Security2Test.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/Security2Test.java
Wed Sep 10 07:56:56 2008
@@ -66,7 +66,7 @@
 				if (isAlias(key)) {
 					String aliasVal = key.substring("ALG.ALIAS.".length());
 					String aliasKey = aliasVal.substring(0, aliasVal
-							.indexOf(".") + 1)
+							.indexOf('.') + 1)
 							+ entry.getValue();
 					// Skip over nonsense alias declarations where alias and
 					// aliased are identical. Such entries can occur.
@@ -165,7 +165,7 @@
 				}
 
 				if (filterString != null) {
-					if (filterString.indexOf(" ") == -1) {
+					if (filterString.indexOf(' ') == -1) {
 						// Is this filter string in the keys of the
 						// current provider ?
 						if (!allProviderKeys.contains(filterString)) {
@@ -334,4 +334,4 @@
 			Security.removeProvider(entrust.getName());
 		}
 	}
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/plaf/basic/BasicTextUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/plaf/basic/BasicTextUITest.java?rev=693864&r1=693863&r2=693864&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/plaf/basic/BasicTextUITest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/plaf/basic/BasicTextUITest.java
Wed Sep 10 07:56:56 2008
@@ -387,7 +387,7 @@
     private String getKeymapName(final JTextComponent c) {
         BasicTextUI ui = (BasicTextUI) jta.getUI();
         String className = ui.getClass().getName();
-        int start = className.lastIndexOf(".");
+        int start = className.lastIndexOf('.');
         int end = className.length();
         String keymapName = className.substring(start + 1, end);
         return keymapName;

Modified: harmony/enhanced/classlib/trunk/support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java?rev=693864&r1=693863&r2=693864&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java
(original)
+++ harmony/enhanced/classlib/trunk/support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java
Wed Sep 10 07:56:56 2008
@@ -157,7 +157,7 @@
      */
     protected File getDataFile(int index) {
         String name = this.getClass().getName();
-        int dot = name.lastIndexOf(".");
+        int dot = name.lastIndexOf('.');
         String path = name.substring(0, dot).replace('.', File.separatorChar);
         if (outputPath != null && outputPath.length() != 0) {
             path = outputPath + File.separator + path;



Mime
View raw message