[jbossws-issues] [JBoss JIRA] Created: (JBWS-2404) Efficient string handling

Anthony Whitford (JIRA) jira-events at lists.jboss.org
Mon Nov 24 02:26:46 EST 2008


Efficient string handling
-------------------------

                 Key: JBWS-2404
                 URL: https://jira.jboss.org/jira/browse/JBWS-2404
             Project: JBoss Web Services
          Issue Type: Patch
      Security Level: Public (Everyone can see)
          Components: jbossws-native
    Affects Versions: jbossws-native-3.0.4
            Reporter: Anthony Whitford


Browsing the code, I came across some low hanging fruit around string usage.  For example:

native\modules\core\src\main\java\org\jboss\ws\metadata\wsdl\WSDLUtils.java 	445 	Use equals() to compare strings instead of '==' or '!='
native\modules\core\src\main\java\org\jboss\ws\metadata\wsdl\WSDLUtils.java 	549 	String.indexOf(char) is faster than String.indexOf(String).
native\modules\core\src\main\java\org\jboss\ws\metadata\wsdl\WSDLUtils.java 	648 	Use equals() to compare strings instead of '==' or '!='
native\modules\core\src\main\java\org\jboss\ws\metadata\wsdl\WSDLUtils.java 	664 	String.indexOf(char) is faster than String.indexOf(String).

Also noticed that there was the odd "bug", like:

   public String firstLetterUpperCase(String fname)
   {
      if (fname == "" || fname == null)
         throw new WSException("String passed is null");
...

The null check should be first, and comparing to an empty string literal isn't exactly the same thing as detecting an empty string.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jbossws-issues mailing list