cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1407529 - in /cxf/trunk: rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/tcp/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/ rt/transports/j...
Date Fri, 09 Nov 2012 16:33:46 GMT
Author: coheigea
Date: Fri Nov  9 16:33:43 2012
New Revision: 1407529

URL: http://svn.apache.org/viewvc?rev=1407529&view=rev
Log:
Replacing some String appending stuff in loops with StringBuilder

Modified:
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/tcp/SoapTcpOutputStream.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriInfoImpl.java
    cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
    cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java
    cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java
    cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/PortTypeVisitor.java
    cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaBinding.java
    cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToIDLAction.java
    cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/utils/FileOutputStreamFactory.java
    cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
    cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/tcp/SoapTcpOutputStream.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/tcp/SoapTcpOutputStream.java?rev=1407529&r1=1407528&r2=1407529&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/tcp/SoapTcpOutputStream.java
(original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/tcp/SoapTcpOutputStream.java
Fri Nov  9 16:33:43 2012
@@ -102,20 +102,21 @@ public class SoapTcpOutputStream extends
     private int openChannel(final String targetWsURI, final List<String> supportedMimeTypes,
                             final List<String> supportedParams) throws IOException
{
         
-        String openChannelMsg = "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+        String initialMessage = "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
             + "<s:Body><openChannel xmlns=\"http://servicechannel.tcp.transport.ws.xml.sun.com/\""
             + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
             + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">";
-        openChannelMsg += "<targetWSURI xmlns=\"\">" + targetWsURI + "</targetWSURI>";
+        StringBuilder openChannelMsg = new StringBuilder(initialMessage);
+        openChannelMsg.append("<targetWSURI xmlns=\"\">" + targetWsURI + "</targetWSURI>");
         
         for (String mimeType : supportedMimeTypes) {
-            openChannelMsg += "<negotiatedMimeTypes xmlns=\"\">" + mimeType + "</negotiatedMimeTypes>";
+            openChannelMsg.append("<negotiatedMimeTypes xmlns=\"\">" + mimeType + "</negotiatedMimeTypes>");
         }
         for (String param : supportedParams) {
-            openChannelMsg += "<negotiatedParams xmlns=\"\">" + param + "</negotiatedParams>";
+            openChannelMsg.append("<negotiatedParams xmlns=\"\">" + param + "</negotiatedParams>");
         }
 
-        openChannelMsg += "</openChannel></s:Body></s:Envelope>";
+        openChannelMsg.append("</openChannel></s:Body></s:Envelope>");
         
         SoapTcpFrameContentDescription contentDesc = new SoapTcpFrameContentDescription();
         contentDesc.setContentId(0);
@@ -131,7 +132,7 @@ public class SoapTcpOutputStream extends
         frame.setHeader(header);
         frame.setChannelId(0);
         try {
-            frame.setPayload(openChannelMsg.getBytes("UTF-8"));
+            frame.setPayload(openChannelMsg.toString().getBytes("UTF-8"));
             SoapTcpUtils.writeMessageFrame(outStream, frame);
         } catch (UnsupportedEncodingException e) {
             e.printStackTrace();

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriInfoImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriInfoImpl.java?rev=1407529&r1=1407528&r2=1407529&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriInfoImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriInfoImpl.java Fri
Nov  9 16:33:43 2012
@@ -175,7 +175,7 @@ public class UriInfoImpl implements UriI
         if (stack != null) {
             List<String> objects = new ArrayList<String>();
             List<String> uris = new LinkedList<String>();
-            String sum = "";
+            StringBuilder sum = new StringBuilder("");
             for (MethodInvocationInfo invocation : stack) {
                 OperationResourceInfo ori = invocation.getMethodInfo();
                 URITemplate[] paths = {
@@ -185,10 +185,10 @@ public class UriInfoImpl implements UriI
                 for (URITemplate t : paths) {
                     if (t != null) {
                         String v = t.getValue();
-                        sum += "/" + (decode ? HttpUtils.pathDecode(v) : v);
+                        sum.append("/" + (decode ? HttpUtils.pathDecode(v) : v));
                     }
                 }
-                UriBuilder ub = UriBuilder.fromPath(sum);
+                UriBuilder ub = UriBuilder.fromPath(sum.toString());
                 objects.addAll(invocation.getTemplateValues());
                 uris.add(0, ub.build(objects.toArray()).normalize().getPath());
             }

Modified: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java?rev=1407529&r1=1407528&r2=1407529&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java
(original)
+++ cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java
Fri Nov  9 16:33:43 2012
@@ -412,15 +412,16 @@ public class FiqlParser<T> implements Se
         @Override
         public String toString() {
             String s = operator.equals(AND) ? "AND" : "OR";
-            s += ":[";
+            StringBuilder builder = new StringBuilder(s);
+            builder.append(":[");
             for (int i = 0; i < subnodes.size(); i++) {
-                s += subnodes.get(i);
+                builder.append(subnodes.get(i));
                 if (i < subnodes.size() - 1) {
-                    s += ", ";
+                    builder.append(", ");
                 }
             }
-            s += "]";
-            return s;
+            builder.append("]");
+            return builder.toString();
         }
 
         public SearchCondition<T> build() throws SearchParseException {

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java?rev=1407529&r1=1407528&r2=1407529&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
Fri Nov  9 16:33:43 2012
@@ -45,8 +45,13 @@ public class JMSEndpoint extends JMSEndp
     }
 
     public String getRequestURI() {
-        String requestUri = "jms:" + (jmsVariant == JMSURIConstants.JNDI_TOPIC ? "jndi" :
jmsVariant)
-            + ":" + destinationName;
+        StringBuilder requestUri = new StringBuilder("jms:");
+        if (jmsVariant == JMSURIConstants.JNDI_TOPIC) {
+            requestUri.append("jndi");
+        } else {
+            requestUri.append(jmsVariant);
+        }
+        requestUri.append(":" + destinationName);
         boolean first = true;
         for (String key : parameters.keySet()) {
             // now we just skip the MESSAGE_TYPE_PARAMETER_NAME 
@@ -57,13 +62,13 @@ public class JMSEndpoint extends JMSEndp
             }
             String value = parameters.get(key);
             if (first) {
-                requestUri += "?" + key + "=" + value;
+                requestUri.append("?" + key + "=" + value);
                 first = false;
             } else {
-                requestUri += "&" + key + "=" + value;
+                requestUri.append("&" + key + "=" + value);
             }
         }
-        return requestUri;
+        return requestUri.toString();
     }
 
     /**

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java?rev=1407529&r1=1407528&r2=1407529&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java
(original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ConstVisitor.java
Fri Nov  9 16:33:43 2012
@@ -63,18 +63,22 @@ public class ConstVisitor extends Visito
         AST constNameNode = TypesUtils.getCorbaTypeNameNode(constTypeNode);
         AST constValueNode = constNameNode.getNextSibling();
         // build value string
-        String constValue = constValueNode.toString();
+        StringBuilder constValue = new StringBuilder();
+        if (constValueNode.toString() != null) {
+            constValue.append(constValueNode.toString());
+        }
         constValueNode = constValueNode.getFirstChild();
-        if (constValue != null && constValue.length() == 1) {
+        if (constValue.length() == 1) {
             // might be a control char
             byte ch = (byte)constValue.charAt(0);
             if (ch >= 0 && ch <= 31) {
                 // ascii code between 0 and 31 is invisible control code
-                constValue = "\\" + Integer.toOctalString(ch);
+                constValue.deleteCharAt(0);
+                constValue.append("\\" + Integer.toOctalString(ch));
             }
         }
         while (constValueNode != null) {
-            constValue = constValue + constValueNode.toString();
+            constValue.append(constValueNode.toString());
             constValueNode = constValueNode.getFirstChild();
         }
         
@@ -103,7 +107,7 @@ public class ConstVisitor extends Visito
         // corba:const        
         Const corbaConst = new Const();
         corbaConst.setQName(constQName);
-        corbaConst.setValue(constValue);        
+        corbaConst.setValue(constValue.toString());        
         corbaConst.setType(constSchemaType.getQName());
         corbaConst.setIdltype(constCorbaType.getQName());        
         

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java?rev=1407529&r1=1407528&r2=1407529&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java
(original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java
Fri Nov  9 16:33:43 2012
@@ -437,12 +437,12 @@ public class IDLToWSDLProcessor extends 
             if (!isDefaultMapping && !serviceNames.containsKey(ns)) {
                 String[] bindingTokens = bindings[i].getQName().getLocalPart().split("\\.");
                 if (bindingTokens.length > 1) {
-                    String name = "";
+                    StringBuilder name = new StringBuilder("");
                     for (int j = 0; j < bindingTokens.length - 2; j++) {
-                        name += bindingTokens[j] + ".";
+                        name.append(bindingTokens[j] + ".");
                     }
-                    name += bindingTokens[bindingTokens.length - 2] + "CORBAService";
-                    serviceNames.put(ns, name);
+                    name.append(bindingTokens[bindingTokens.length - 2] + "CORBAService");
+                    serviceNames.put(ns, name.toString());
                 } else {
                     serviceNames.put(ns, idl + "CORBAService");
                 }

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/PortTypeVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/PortTypeVisitor.java?rev=1407529&r1=1407528&r2=1407529&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/PortTypeVisitor.java
(original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/PortTypeVisitor.java
Fri Nov  9 16:33:43 2012
@@ -232,13 +232,13 @@ public class PortTypeVisitor extends Vis
 
     
     public Binding createBinding(String scopedPortTypeName) {
-        String bname = scopedPortTypeName + "CORBABinding";
+        StringBuilder bname = new StringBuilder(scopedPortTypeName + "CORBABinding");
         QName bqname = new QName(rootDefinition.getTargetNamespace(),
-                                 bname);
+                                 bname.toString());
         int count = 0;
         while (queryBinding(bqname)) {
-            bname = bname + count;
-            bqname = new QName(rootDefinition.getTargetNamespace(), bname);
+            bname.append(count);
+            bqname = new QName(rootDefinition.getTargetNamespace(), bname.toString());
         }
         Binding binding = rootDefinition.createBinding();
         binding.setPortType(portType);

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaBinding.java?rev=1407529&r1=1407528&r2=1407529&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaBinding.java
(original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToCorbaBinding.java
Fri Nov  9 16:33:43 2012
@@ -244,10 +244,12 @@ public class WSDLToCorbaBinding {
             setBindingName(bname);
             bqname = new QName(definition.getTargetNamespace(), bname, prefix);
             int count = 0;
+            StringBuilder builder = new StringBuilder(bname);
             while (WSDLToCorbaHelper.queryBinding(definition, bqname)) {
-                bname = bname + count;
-                bqname = new QName(definition.getTargetNamespace(), bname, prefix);
+                builder.append(count);
+                bqname = new QName(definition.getTargetNamespace(), builder.toString(), prefix);
             }
+            bname = builder.toString();
         } else {
             bqname = new QName(definition.getTargetNamespace(), bname, prefix);
             // Check if the Binding with name already exists

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToIDLAction.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToIDLAction.java?rev=1407529&r1=1407528&r2=1407529&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToIDLAction.java
(original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/wsdl/WSDLToIDLAction.java
Fri Nov  9 16:33:43 2012
@@ -450,17 +450,17 @@ public class WSDLToIDLAction {
         }
         
         IdlScopeBase scope = root;
-        String dotScopedName = "";
+        StringBuilder dotScopedName = new StringBuilder("");
 
         for (int i = 0; i < name.length - 1; ++i) {
-            dotScopedName += name[i];
+            dotScopedName.append(name[i]);
 
             // If we have the name CORBA, we need to make sure we are not handling the CORBA.Object
             // name which is used for object references.  If so, we don't want to generate
a module
             // since it is not a type we need to define in our IDL.  This only happens when
the 
             // name is "CORBA", we have a name array of length 2 and we are at the beginning
of the
             // name array.
-            if ("CORBA".equals(dotScopedName)
+            if ("CORBA".equals(dotScopedName.toString())
                 && name.length == 2 && i == 0
                 && name[1].equals("Object")) {
                 break;
@@ -474,7 +474,7 @@ public class WSDLToIDLAction {
                 // For example if type is a.b.c and we are about to create
                 // module b,look to see if a.b
                 // is an interface that needs to be processed
-                QName qname = new QName(corbaTypeImpl.getType().getNamespaceURI(), dotScopedName);
+                QName qname = new QName(corbaTypeImpl.getType().getNamespaceURI(), dotScopedName.toString());
 
                 // Check to see if CORBAType exists. If so, create type for it
                 // otherwise
@@ -491,7 +491,7 @@ public class WSDLToIDLAction {
                 }
             }
 
-            dotScopedName += ".";
+            dotScopedName.append(".");
             scope = (IdlScopeBase)idlDef;
         }
 

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/utils/FileOutputStreamFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/utils/FileOutputStreamFactory.java?rev=1407529&r1=1407528&r2=1407529&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/utils/FileOutputStreamFactory.java
(original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/utils/FileOutputStreamFactory.java
Fri Nov  9 16:33:43 2012
@@ -93,19 +93,19 @@ public class FileOutputStreamFactory imp
 
 
     private String convertPackageNameToDirectory(String packageName) {
-        String result = "";
         int pos1 = 0;
         int pos2 = packageName.indexOf(".", pos1);
 
+        StringBuilder result = new StringBuilder("");
         while (pos2 != -1) {
-            result += packageName.substring(pos1, pos2) + File.separator;
+            result.append(packageName.substring(pos1, pos2) + File.separator);
             pos1 = pos2 + 1;
             pos2 = packageName.indexOf(".", pos1);
         }
 
-        result += packageName.substring(pos1);
+        result.append(packageName.substring(pos1));
 
-        return result;
+        return result.toString();
     }
 
 

Modified: cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java?rev=1407529&r1=1407528&r2=1407529&view=diff
==============================================================================
--- cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
(original)
+++ cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
Fri Nov  9 16:33:43 2012
@@ -413,11 +413,13 @@ public class SourceGenerator {
             if (path.length() > 0) {
                 path = path.replaceAll("[\\{\\}_]*", "");
                 String[] split = path.split("/");
+                StringBuilder builder = new StringBuilder(resourceId);
                 for (int i = 0; i < split.length; i++) {
                     if (split[i].length() > 0) {
-                        resourceId += split[i].toUpperCase().charAt(0) + split[i].substring(1);
+                        builder.append(split[i].toUpperCase().charAt(0) + split[i].substring(1));
                     }
                 }
+                resourceId = builder.toString();
             }
             resourceId += DEFAULT_RESOURCE_NAME;    
         }
@@ -1208,19 +1210,19 @@ public class SourceGenerator {
         if (repElements.size() > 1) {
             sbCode.append("{");
         }
-        String mediaTypes = "";
         boolean first = true;
+        StringBuilder mediaTypes = new StringBuilder("");
         for (int i = 0; i < repElements.size(); i++) {
             String mediaType = repElements.get(i).getAttribute("mediaType");
-            if (mediaType != null && !mediaTypes.contains(mediaType)) {
+            if (mediaType != null && (mediaTypes.indexOf(mediaType) < 0)) {
                 if (!first) { 
-                    mediaTypes += ", ";
+                    mediaTypes.append(", ");
                 }
                 first = false;
-                mediaTypes += "\"" + mediaType + "\"";
+                mediaTypes.append("\"" + mediaType + "\"");
             }
         }
-        sbCode.append(mediaTypes);
+        sbCode.append(mediaTypes.toString());
         if (repElements.size() > 1) {
             sbCode.append(" }");
         }

Modified: cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=1407529&r1=1407528&r2=1407529&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
(original)
+++ cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
Fri Nov  9 16:33:43 2012
@@ -411,22 +411,22 @@ public class JAXBDataBinding implements 
                 opts.addGrammar(new InputSource("null"));
                 opts.parseArguments(args.toArray(new String[args.size()]));
             } catch (BadCommandLineException e) {
-                String msg = "XJC reported 'BadCommandLineException' for -xjc argument:";
+                StringBuilder msg = new StringBuilder("XJC reported 'BadCommandLineException'
for -xjc argument:");
                 for (String arg : args) {
-                    msg = msg + arg + " ";
+                    msg.append(arg + " ");
                 }
-                LOG.log(Level.FINE, msg, e);
+                LOG.log(Level.FINE, msg.toString(), e);
                 if (opts != null) {
                     String pluginUsage = getPluginUsageString(opts);
-                    msg = msg + System.getProperty("line.separator");
+                    msg.append(System.getProperty("line.separator"));
                     if (args.contains("-X")) {
-                        msg = pluginUsage;
+                        throw new ToolException(pluginUsage, e);
                     } else {
-                        msg += pluginUsage;
+                        msg.append(pluginUsage);
                     }
                 }
 
-                throw new ToolException(msg, e);
+                throw new ToolException(msg.toString(), e);
             }
         }
         

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java?rev=1407529&r1=1407528&r2=1407529&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
Fri Nov  9 16:33:43 2012
@@ -101,20 +101,22 @@ public class ServiceProcessor extends Ab
         }
 
     }
-    private String mapName(String packageName, String name) {
-        while (isNameCollision(packageName, name)) {
-            name = name + "_Service";
+    private String mapName(String packageName, final String name) {
+        StringBuilder builder = new StringBuilder(name);
+        while (isNameCollision(packageName, builder.toString())) {
+            builder.append("_Service");
         }
+        String newName = builder.toString();
         ClassCollector collector = context.get(ClassCollector.class);
-        if (collector.isReserved(packageName, name)) {
+        if (collector.isReserved(packageName, newName)) {
             int count = 0;
-            String checkName = name;
+            String checkName = newName;
             while (collector.isReserved(packageName, checkName)) {
-                checkName = name + (++count);
+                checkName = newName + (++count);
             }
-            name = checkName;
+            newName = checkName;
         }
-        return name;
+        return newName;
     }
 
     private boolean isNameCollision(String packageName, String className) {



Mime
View raw message