Author: alessio.soldano(a)jboss.com
Date: 2009-01-05 13:44:31 -0500 (Mon, 05 Jan 2009)
New Revision: 8962
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaXmlTypeMapping.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java
Log:
[JBWS-2404] Efficient string handling
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2009-01-05
16:20:01 UTC (rev 8961)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2009-01-05
18:44:31 UTC (rev 8962)
@@ -227,9 +227,9 @@
String resourcePath = packagePath + "/" + filepath;
while (filepath.startsWith("../"))
{
- packagePath = packagePath.substring(0,
packagePath.lastIndexOf("/"));
+ packagePath = packagePath.substring(0,
packagePath.lastIndexOf('/'));
filepath = filepath.substring(3);
- resourcePath = packagePath + "/" + filepath;
+ resourcePath = packagePath + '/' + filepath;
}
fileURL = wsClass.getClassLoader().getResource(resourcePath);
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaXmlTypeMapping.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaXmlTypeMapping.java 2009-01-05
16:20:01 UTC (rev 8961)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/jaxrpcmapping/JavaXmlTypeMapping.java 2009-01-05
18:44:31 UTC (rev 8962)
@@ -126,21 +126,21 @@
public String serialize()
{
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = new StringBuffer(100);
sb.append("<java-xml-type-mapping>");
sb.append("<java-type>").append(javaType).append("</java-type>");
if (rootTypeQName != null)
{
sb.append("<root-type-qname
xmlns:typeNS='").append(rootTypeQName.getNamespaceURI()).append("'>");
-
sb.append(rootTypeQName.getPrefix()).append(":").append(rootTypeQName.getLocalPart());
+
sb.append(rootTypeQName.getPrefix()).append(':').append(rootTypeQName.getLocalPart());
sb.append("</root-type-qname>");
}
if (anonymousTypeQName != null)
{
sb.append("<anonymous-type-qname
xmlns:typeNS='").append(anonymousTypeQName.getNamespaceURI()).append("'>");
-
sb.append(anonymousTypeQName.getPrefix()).append(":").append(anonymousTypeQName.getLocalPart());
+
sb.append(anonymousTypeQName.getPrefix()).append(':').append(anonymousTypeQName.getLocalPart());
sb.append("</anonymous-type-qname>");
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java 2009-01-05
16:20:01 UTC (rev 8961)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/ParameterMetaData.java 2009-01-05
18:44:31 UTC (rev 8962)
@@ -563,32 +563,32 @@
{
boolean isReturn = (opMetaData.getReturnParameter() == this);
StringBuilder buffer = new StringBuilder("\n" + (isReturn ?
"ReturnMetaData:" : "ParameterMetaData:"));
- buffer.append("\n xmlName=" + getXmlName());
- buffer.append("\n partName=" + getPartName());
- buffer.append("\n xmlType=" + getXmlType());
+ buffer.append("\n xmlName=").append(getXmlName());
+ buffer.append("\n partName=").append(getPartName());
+ buffer.append("\n xmlType=").append(getXmlType());
if (soapArrayParam)
- buffer.append("\n soapArrayCompType=" + soapArrayCompType);
+ buffer.append("\n soapArrayCompType=").append(soapArrayCompType);
- buffer.append("\n javaType=" + getJavaTypeName());
- buffer.append("\n mode=" + getMode());
- buffer.append("\n inHeader=" + isInHeader());
- buffer.append("\n index=" + index);
+ buffer.append("\n javaType=").append(getJavaTypeName());
+ buffer.append("\n mode=").append(getMode());
+ buffer.append("\n inHeader=").append(isInHeader());
+ buffer.append("\n index=").append(index);
if (isSwA())
{
- buffer.append("\n isSwA=" + isSwA());
- buffer.append("\n mimeTypes=" + getMimeTypes());
+ buffer.append("\n isSwA=").append(isSwA());
+ buffer.append("\n mimeTypes=").append(getMimeTypes());
}
if (isXOP())
{
- buffer.append("\n isXOP=" + isXOP());
- buffer.append("\n mimeTypes=" + getMimeTypes());
+ buffer.append("\n isXOP=").append(isXOP());
+ buffer.append("\n mimeTypes=").append(getMimeTypes());
}
if (wrappedParameters != null)
- buffer.append("\n wrappedParameters=" + wrappedParameters);
+ buffer.append("\n wrappedParameters=").append(wrappedParameters);
return buffer.toString();
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java 2009-01-05
16:20:01 UTC (rev 8961)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java 2009-01-05
18:44:31 UTC (rev 8962)
@@ -113,10 +113,10 @@
public String registerNamespaceURI(String nsURI, String prefix)
{
String pre = namespaces.getPrefix(nsURI);
- if (pre == null || pre == "")
+ if (pre == null || 0 == pre.length())
{
pre = namespaces.registerURI(nsURI, prefix);
- log.trace("registerNamespaceURI: " + pre + "=" + nsURI);
+ log.trace("registerNamespaceURI: " + pre + '=' + nsURI);
}
return pre;
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java 2009-01-05
16:20:01 UTC (rev 8961)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/wsdl/WSDLUtils.java 2009-01-05
18:44:31 UTC (rev 8962)
@@ -442,15 +442,15 @@
*/
public String firstLetterUpperCase(String fname)
{
- if (fname == "" || fname == null)
+ if (fname == null || fname.length() == 0)
throw new WSException("String passed is null");
//Ensure that the first character is uppercase
- if (Character.isLowerCase(fname.charAt(0)))
+ final char firstChar = fname.charAt(0);
+ if (Character.isLowerCase(firstChar))
{
- char[] chars = fname.toCharArray();
- char f = Character.toUpperCase(chars[0]);
- chars[0] = f;
- fname = new String(chars);
+ final StringBuilder sb = new StringBuilder(fname);
+ sb.setCharAt(0, Character.toUpperCase(firstChar));
+ fname = sb.toString();
}
return fname;
}
@@ -546,7 +546,7 @@
*/
public static String getJustClassName(String classname)
{
- int index = classname.lastIndexOf(".");
+ int index = classname.lastIndexOf('.');
if (index < 0)
index = 0;
else index = index + 1;
@@ -645,9 +645,9 @@
StringBuilder sb = new StringBuilder();
String prefix = qn.getPrefix();
String localpart = qn.getLocalPart();
- if (prefix == null || prefix == "")
+ if (prefix == null || prefix.length() == 0)
prefix = Constants.PREFIX_TNS;
- sb.append(prefix + ":");
+ sb.append(prefix).append(':');
sb.append(localpart);
return sb.toString();
@@ -661,7 +661,7 @@
public QName getQName(String formattedStr)
{
QName qn = null;
- int ind = formattedStr.lastIndexOf(":");
+ int ind = formattedStr.lastIndexOf(':');
if (ind < 0)
throw new IllegalArgumentException("Formatted String is not of format
prefix:localpart");
String prefix = formattedStr.substring(0, ind);
@@ -722,12 +722,12 @@
while (!stk.isEmpty() && (next = stk.pop()) != null)
{
if (sb.toString().equals("http://") == false)
- sb.append(".");
+ sb.append('.');
sb.append(next);
}
// trailing slash
- sb.append("/");
+ sb.append('/');
return sb.toString();
}
Show replies by date