Remove String Concats and replace with StringBuilder

Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/f607b289
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/f607b289
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/f607b289

Branch: refs/heads/avrorpc
Commit: f607b289865ccfeb3ebc8cf965d00634e35423ca
Parents: 1ff4de9
Author: Tom Barber <[email protected]>
Authored: Sun Jan 10 21:52:02 2016 +0000
Committer: Tom Barber <[email protected]>
Committed: Sun Jan 10 21:52:02 2016 +0000

----------------------------------------------------------------------
 .../gui/pstructs/ProfileAttributesPrinter.java  | 26 ++++++------
 .../gui/pstructs/ProfileElementPrinter.java     | 21 +++++-----
 .../profile/gui/pstructs/ProfilePrinter.java    | 16 ++++----
 .../gui/pstructs/ResourceAttributesPrinter.java | 42 ++++++++++----------
 .../resource/system/XmlRpcResourceManager.java  | 26 ++++++------
 .../cli/action/GetTaskByIdCliAction.java        |  8 ++--
 .../cli/action/GetWorkflowByIdCliAction.java    |  8 ++--
 .../action/GetWorkflowsByEventCliAction.java    |  8 ++--
 .../oodt/cas/workflow/util/ScriptFile.java      |  8 ++--
 .../java/org/apache/oodt/xmlquery/XMLQuery.java | 33 ++++++++-------
 10 files changed, 100 insertions(+), 96 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oodt/blob/f607b289/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileAttributesPrinter.java
----------------------------------------------------------------------
diff --git 
a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileAttributesPrinter.java
 
b/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileAttributesPrinter.java
index 385153a..8599cfe 100755
--- 
a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileAttributesPrinter.java
+++ 
b/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileAttributesPrinter.java
@@ -45,31 +45,31 @@ public class ProfileAttributesPrinter {
        }
        
        public String toXMLString(){
-               String rStr="";
+               StringBuilder rStr= new StringBuilder();
                
-               rStr+="<profAttributes>\n";
-               rStr+="\t<profId>"+myProfAttributes.getID()+"</profId>\n";
-               rStr+="\t<profType>"+myProfAttributes.getType()+"</profType>\n";
-               
rStr+="\t<profVersion>"+myProfAttributes.getVersion()+"</profVersion>\n";
-               
rStr+="\t<profStatusId>"+myProfAttributes.getStatusID()+"</profStatusId>\n";
-               
rStr+="\t<profSecurityType>"+myProfAttributes.getSecurityType()+"</profSecurityType>\n";
-               
rStr+="\t<profParentId>"+myProfAttributes.getParent()+"</profParentId>\n";
+               rStr.append("<profAttributes>\n");
+               
rStr.append("\t<profId>").append(myProfAttributes.getID()).append("</profId>\n");
+               
rStr.append("\t<profType>").append(myProfAttributes.getType()).append("</profType>\n");
+               
rStr.append("\t<profVersion>").append(myProfAttributes.getVersion()).append("</profVersion>\n");
+               
rStr.append("\t<profStatusId>").append(myProfAttributes.getStatusID()).append("</profStatusId>\n");
+               
rStr.append("\t<profSecurityType>").append(myProfAttributes.getSecurityType()).append("</profSecurityType>\n");
+               
rStr.append("\t<profParentId>").append(myProfAttributes.getParent()).append("</profParentId>\n");
 
          for (Object o1 : myProfAttributes.getChildren()) {
                String theChild = (String) o1;
-               rStr += "\t<profChildId>" + theChild + "</profChildId>\n";
+               
rStr.append("\t<profChildId>").append(theChild).append("</profChildId>\n");
          }
                
-               
rStr+="\t<profRegAuthority>"+myProfAttributes.getRegAuthority()+"</profRegAuthority>\n";
+               
rStr.append("\t<profRegAuthority>").append(myProfAttributes.getRegAuthority()).append("</profRegAuthority>\n");
 
          for (Object o : myProfAttributes.getRevisionNotes()) {
                String theNote = (String) o;
-               rStr += "\t<profRevisionNote>" + theNote + 
"</profRevisionNote>\n";
+               
rStr.append("\t<profRevisionNote>").append(theNote).append("</profRevisionNote>\n");
          }
                
-               rStr+="</profAttributes>\n\n";
+               rStr.append("</profAttributes>\n\n");
                
 
-               return rStr;
+               return rStr.toString();
        }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/f607b289/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileElementPrinter.java
----------------------------------------------------------------------
diff --git 
a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileElementPrinter.java
 
b/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileElementPrinter.java
index ed431f9..3c443ca 100755
--- 
a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileElementPrinter.java
+++ 
b/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfileElementPrinter.java
@@ -44,20 +44,21 @@ public class ProfileElementPrinter {
        }
        
        public String toXMLString(){
-               String rStr="";
+               StringBuilder rStr= new StringBuilder();
                
-                 rStr+="<profElement>\n";
-                 
rStr+="\t<elemName>"+myProfileElement.getName()+"</elemName>\n";
-                 
rStr+="\t<elemMaxOccurrence>"+myProfileElement.getMaxOccurrence()+"</elemMaxOccurrence>\n";
-                 
rStr+="\t<elemMaxValue>"+myProfileElement.getMaxValue()+"</elemMaxValue>\n";
-                 
rStr+="\t<elemMinValue>"+myProfileElement.getMinValue()+"</elemMinValue>\n";
+                 rStr.append("<profElement>\n");
+                 
rStr.append("\t<elemName>").append(myProfileElement.getName()).append("</elemName>\n");
+                 
rStr.append("\t<elemMaxOccurrence>").append(myProfileElement.getMaxOccurrence())
+                         .append("</elemMaxOccurrence>\n");
+                 
rStr.append("\t<elemMaxValue>").append(myProfileElement.getMaxValue()).append("</elemMaxValue>\n");
+                 
rStr.append("\t<elemMinValue>").append(myProfileElement.getMinValue()).append("</elemMinValue>\n");
 
          for (Object o : myProfileElement.getValues()) {
                String theValue = (String) o;
-               rStr += "<elemValue>" + theValue + "</elemValue>\n";
+               
rStr.append("<elemValue>").append(theValue).append("</elemValue>\n");
          }
-                 
rStr+="\t<elemComment>"+myProfileElement.getComments()+"</elemComment>\n";
-                 rStr+="</profElement>\n";
-               return rStr;
+                 
rStr.append("\t<elemComment>").append(myProfileElement.getComments()).append("</elemComment>\n");
+                 rStr.append("</profElement>\n");
+               return rStr.toString();
        }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/f607b289/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfilePrinter.java
----------------------------------------------------------------------
diff --git 
a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfilePrinter.java
 
b/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfilePrinter.java
index 680f653..77989df 100755
--- 
a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfilePrinter.java
+++ 
b/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ProfilePrinter.java
@@ -51,27 +51,27 @@ public class ProfilePrinter {
        }
        
        public String toXMLString(){
-               String rStr = "<?xml version=\"1.0\" ?>\n";
-               rStr+="<!DOCTYPE profile SYSTEM \""+dtdUrl+"\">\n\n";
-               rStr+="<profile>\n";
+               StringBuilder rStr = new StringBuilder("<?xml version=\"1.0\" 
?>\n");
+               rStr.append("<!DOCTYPE profile SYSTEM 
\"").append(dtdUrl).append("\">\n\n");
+               rStr.append("<profile>\n");
 
                
                ProfileAttributesPrinter pap = new 
ProfileAttributesPrinter(myProfile.getProfileAttributes());
-               rStr+=pap.toXMLString();
+               rStr.append(pap.toXMLString());
                
                
                ResourceAttributesPrinter rap = new 
ResourceAttributesPrinter(myProfile.getResourceAttributes());
-               rStr+=rap.toXMLString();
+               rStr.append(rap.toXMLString());
 
 
          for (String profElemName : myProfile.getProfileElements().keySet()) {
                ProfileElement pe = (ProfileElement) 
myProfile.getProfileElements().get(profElemName);
                ProfileElementPrinter pPrinter = new ProfileElementPrinter(pe);
-               rStr += pPrinter.toXMLString();
+               rStr.append(pPrinter.toXMLString());
          }
                
-               rStr+="</profile>\n";
+               rStr.append("</profile>\n");
                
-               return rStr;
+               return rStr.toString();
        }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/f607b289/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ResourceAttributesPrinter.java
----------------------------------------------------------------------
diff --git 
a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ResourceAttributesPrinter.java
 
b/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ResourceAttributesPrinter.java
index 84302fd..7b9e617 100755
--- 
a/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ResourceAttributesPrinter.java
+++ 
b/profile/src/main/java/org/apache/oodt/profile/gui/pstructs/ResourceAttributesPrinter.java
@@ -50,69 +50,69 @@ public class ResourceAttributesPrinter {
        public ResourceAttributes getResourceAttributes(){return resAttr;}
        
        public String toXMLString(){
-               String rStr="";
+               StringBuilder rStr=new StringBuilder();
                
-                  rStr+="<resAttributes>\n";
+                  rStr.append("<resAttributes>\n");
                   
-                  
rStr+="\t<Identifier>"+resAttr.getIdentifier()+"</Identifier>\n";
-                  rStr+="\t<Title>"+resAttr.getTitle()+"</Title>\n";
-                  rStr+="\t<resClass>"+resAttr.getResClass()+"</resClass>\n";
-                  
rStr+="\t<resAggregation>"+resAttr.getResAggregation()+"</resAggregation>\n";
+                  
rStr.append("\t<Identifier>").append(resAttr.getIdentifier()).append("</Identifier>\n");
+                  
rStr.append("\t<Title>").append(resAttr.getTitle()).append("</Title>\n");
+                  
rStr.append("\t<resClass>").append(resAttr.getResClass()).append("</resClass>\n");
+                  
rStr.append("\t<resAggregation>").append(resAttr.getResAggregation()).append("</resAggregation>\n");
 
          for (String theRight : resAttr.getRights()) {
-               rStr += "\t<Right>" + theRight + "</Right>\n";
+               rStr.append("\t<Right>").append(theRight).append("</Right>\n");
          }
 
          for (String theSource : resAttr.getSources()) {
-               rStr += "\t<Source>" + theSource + "</Source>\n";
+               
rStr.append("\t<Source>").append(theSource).append("</Source>\n");
          }
 
          for (String theSubject : resAttr.getSubjects()) {
-               rStr += "\t<Subject>" + theSubject + "</Subject>\n";
+               
rStr.append("\t<Subject>").append(theSubject).append("</Subject>\n");
          }
 
          for (String theFormat : resAttr.getFormats()) {
-               rStr += "\t<Format>" + theFormat + "</Format>\n";
+               
rStr.append("\t<Format>").append(theFormat).append("</Format>\n");
          }
 
          for (String theCreator : resAttr.getCreators()) {
-               rStr += "\t<Creator>" + theCreator + "</Creator>\n";
+               
rStr.append("\t<Creator>").append(theCreator).append("</Creator>\n");
          }
 
          for (String thePublisher : resAttr.getPublishers()) {
-               rStr += "\t<Publisher>" + thePublisher + "</Publisher>\n";
+               
rStr.append("\t<Publisher>").append(thePublisher).append("</Publisher>\n");
          }
 
          for (String theType : resAttr.getTypes()) {
-               rStr += "\t<Type>" + theType + "</Type>\n";
+               rStr.append("\t<Type>").append(theType).append("</Type>\n");
          }
 
          for (String theContext : resAttr.getResContexts()) {
-               rStr += "\t<resContext>" + theContext + "</resContext>\n";
+               
rStr.append("\t<resContext>").append(theContext).append("</resContext>\n");
          }
 
          for (String theLocation : resAttr.getResLocations()) {
-               rStr += "\t<resLocation>" + theLocation + "</resLocation>\n";
+               
rStr.append("\t<resLocation>").append(theLocation).append("</resLocation>\n");
          }
 
          for (String theContributor : resAttr.getContributors()) {
-               rStr += "\t<Contributor>" + theContributor + "</Contributor>\n";
+               
rStr.append("\t<Contributor>").append(theContributor).append("</Contributor>\n");
          }
 
          for (String theCoverage : resAttr.getCoverages()) {
-               rStr += "\t<Coverage>" + theCoverage + "</Coverage>\n";
+               
rStr.append("\t<Coverage>").append(theCoverage).append("</Coverage>\n");
          }
 
          for (String theLang : resAttr.getLanguages()) {
-               rStr += "\t<Language>" + theLang + "</Language>\n";
+               
rStr.append("\t<Language>").append(theLang).append("</Language>\n");
          }
 
          for (String theRelation : resAttr.getRelations()) {
-               rStr += "\t<Relation>" + theRelation + "</Relation>\n";
+               
rStr.append("\t<Relation>").append(theRelation).append("</Relation>\n");
          }
                   
-                  rStr+="</resAttributes>\n";
+                  rStr.append("</resAttributes>\n");
                   
-               return rStr;
+               return rStr.toString();
        }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/f607b289/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java
----------------------------------------------------------------------
diff --git 
a/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java
 
b/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java
index d17df64..87f6bea 100644
--- 
a/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java
+++ 
b/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java
@@ -356,7 +356,7 @@ public class XmlRpcResourceManager {
     }
     
     public String getNodeReport() throws MonitorException{
-       String report = "";
+       StringBuilder report = new StringBuilder();
        
        try{
                
@@ -368,27 +368,27 @@ public class XmlRpcResourceManager {
             for (Object node1 : nodes) {
                 ResourceNode node = (ResourceNode) node1;
                 String nodeId = node.getNodeId();
-                report += nodeId;
-                report += " (" + getNodeLoad(nodeId) + "/" + 
node.getCapacity() + ")";
+                report.append(nodeId);
+                report.append(" 
(").append(getNodeLoad(nodeId)).append("/").append(node.getCapacity()).append(")");
                 List<String> nodeQueues = getQueuesWithNode(nodeId);
                 if (nodeQueues != null && nodeQueues.size() > 0) {
-                    report += " -- " + nodeQueues.get(0);
+                    report.append(" -- ").append(nodeQueues.get(0));
                     for (int j = 1; j < nodeQueues.size(); j++) {
-                        report += ", " + nodeQueues.get(j);
+                        report.append(", ").append(nodeQueues.get(j));
                     }
                 }
-                report += "\n";
+                report.append("\n");
             }
        
        }catch(Exception e){
                throw new MonitorException(e.getMessage(), e);
        }
        
-       return report;
+       return report.toString();
     }
     
     public String getExecutionReport() throws JobRepositoryException{
-       String report = "";
+       StringBuilder report = new StringBuilder();
        
        try{
        
@@ -413,10 +413,10 @@ public class XmlRpcResourceManager {
                         String jobId = (String) execJobId;
                         Job job = scheduler.getJobQueue().getJobRepository()
                                            .getJobById(jobId).getJob();
-                        report += "job id=" + jobId;
-                        report += ", load=" + job.getLoadValue();
-                        report += ", node=" + nodeId;
-                        report += ", queue=" + job.getQueueName() + "\n";
+                        report.append("job id=").append(jobId);
+                        report.append(", load=").append(job.getLoadValue());
+                        report.append(", node=").append(nodeId);
+                        report.append(", 
queue=").append(job.getQueueName()).append("\n");
                     }
                        }
                }
@@ -425,7 +425,7 @@ public class XmlRpcResourceManager {
                throw new JobRepositoryException(e.getMessage(), e);
        }
        
-       return report;
+       return report.toString();
     }
     
     public static void main(String[] args) throws IOException {

http://git-wip-us.apache.org/repos/asf/oodt/blob/f607b289/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetTaskByIdCliAction.java
----------------------------------------------------------------------
diff --git 
a/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetTaskByIdCliAction.java
 
b/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetTaskByIdCliAction.java
index 47cd829..800f3f9 100644
--- 
a/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetTaskByIdCliAction.java
+++ 
b/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetTaskByIdCliAction.java
@@ -36,12 +36,12 @@ public class GetTaskByIdCliAction extends WorkflowCliAction 
{
       try {
          WorkflowTask task = getClient().getTaskById(taskId);
          
-         String requiredMetFields = "";
+         StringBuilder requiredMetFields = new StringBuilder();
         for (Object o : task.getRequiredMetFields()) {
           if (requiredMetFields.length() > 0) {
-            requiredMetFields += ", ";
+            requiredMetFields.append(", ");
           }
-          requiredMetFields += (String) o;
+          requiredMetFields.append((String) o);
         }
          
          printer.println("Task: [id=" + task.getTaskId() 
@@ -49,7 +49,7 @@ public class GetTaskByIdCliAction extends WorkflowCliAction {
                + ", order=" + task.getOrder() 
                + ", class=" + task.getClass().getName() 
                + ", numConditions=" + task.getConditions().size() 
-               + ", requiredMetadataFields=[" + requiredMetFields+"]"
+               + ", requiredMetadataFields=[" + 
requiredMetFields.toString()+"]"
                + ", configuration="+ task.getTaskConfig().getProperties() + 
"]");
          
       } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/oodt/blob/f607b289/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowByIdCliAction.java
----------------------------------------------------------------------
diff --git 
a/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowByIdCliAction.java
 
b/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowByIdCliAction.java
index 655766c..b6da865 100644
--- 
a/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowByIdCliAction.java
+++ 
b/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowByIdCliAction.java
@@ -37,17 +37,17 @@ public class GetWorkflowByIdCliAction extends 
WorkflowCliAction {
       try {
          Workflow workflow = getClient().getWorkflowById(workflowId);
          
-         String taskIds = "";
+         StringBuilder taskIds = new StringBuilder();
          for (WorkflowTask wt : workflow.getTasks()) {
                 if (taskIds.length()>0) {
-               taskIds += ", ";
+               taskIds.append(", ");
              }
-                taskIds += wt.getTaskId();
+                taskIds.append(wt.getTaskId());
          }
          
          printer.println("Workflow: [id=" + workflow.getId() + ", name="
                + workflow.getName() + ", numTasks="
-               + workflow.getTasks().size() + ", taskIds="+taskIds+"]");
+               + workflow.getTasks().size() + ", 
taskIds="+taskIds.toString()+"]");
          
       } catch (Exception e) {
          throw new CmdLineActionException(

http://git-wip-us.apache.org/repos/asf/oodt/blob/f607b289/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowsByEventCliAction.java
----------------------------------------------------------------------
diff --git 
a/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowsByEventCliAction.java
 
b/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowsByEventCliAction.java
index 7661cad..5d33497 100644
--- 
a/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowsByEventCliAction.java
+++ 
b/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowsByEventCliAction.java
@@ -47,17 +47,17 @@ public class GetWorkflowsByEventCliAction extends 
WorkflowCliAction {
          
          for (Workflow workflow : workflows) {
                 
-             String taskIds = "";
+             StringBuilder taskIds = new StringBuilder();
              for (WorkflowTask wt : workflow.getTasks()) {
                 if (taskIds.length()>0) {
-                   taskIds += ", ";
+                   taskIds.append(", ");
                  }
-                taskIds += wt.getTaskId();
+                taskIds.append(wt.getTaskId());
              }
                 
             printer.println("Workflow: [id=" + workflow.getId() + ", name="
                   + workflow.getName() + ", numTasks="
-                  + workflow.getTasks().size() + ", taskIds="+taskIds + "]");
+                  + workflow.getTasks().size() + ", 
taskIds="+taskIds.toString() + "]");
          }
          
       } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/oodt/blob/f607b289/workflow/src/main/java/org/apache/oodt/cas/workflow/util/ScriptFile.java
----------------------------------------------------------------------
diff --git 
a/workflow/src/main/java/org/apache/oodt/cas/workflow/util/ScriptFile.java 
b/workflow/src/main/java/org/apache/oodt/cas/workflow/util/ScriptFile.java
index 0e123f1..c2eb6d4 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/util/ScriptFile.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/util/ScriptFile.java
@@ -97,16 +97,16 @@ public class ScriptFile {
     }
 
     public String toString() {
-        String rStr = "";
+        StringBuilder rStr = new StringBuilder();
 
-        rStr += "#!" + commandShell + "\n";
+        rStr.append("#!").append(commandShell).append("\n");
 
         for (Object command : commands) {
             String cmd = (String) command;
-            rStr += cmd + "\n";
+            rStr.append(cmd).append("\n");
         }
 
-        return rStr;
+        return rStr.toString();
     }
 
     public void writeScriptFile(String filePath) throws WorkflowException {

http://git-wip-us.apache.org/repos/asf/oodt/blob/f607b289/xmlquery/src/main/java/org/apache/oodt/xmlquery/XMLQuery.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/XMLQuery.java 
b/xmlquery/src/main/java/org/apache/oodt/xmlquery/XMLQuery.java
index 7ec6643..eade767 100755
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/XMLQuery.java
+++ b/xmlquery/src/main/java/org/apache/oodt/xmlquery/XMLQuery.java
@@ -22,6 +22,18 @@
 
 package org.apache.oodt.xmlquery;
 
+import org.apache.oodt.commons.util.EnterpriseEntityResolver;
+import org.apache.oodt.commons.util.XML;
+import org.apache.oodt.product.Retriever;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.SAXException;
+
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.FileReader;
@@ -32,6 +44,7 @@ import java.io.StringWriter;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -41,16 +54,6 @@ import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
-import org.apache.oodt.product.Retriever;
-import org.apache.oodt.commons.util.EnterpriseEntityResolver;
-import org.apache.oodt.commons.util.XML;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.SAXException;
 
 /**
  * EDA XML query class. Parses a DIS style keyword query and creates query 
@@ -679,21 +682,21 @@ public class XMLQuery implements java.io.Serializable, 
Cloneable {
     private String replaceCharWithString (String s1, char c, String rs)
        {
         int p1, p2, s1l;
-       String s2;
+       StringBuilder s2;
        
        p1 = 0;
          s1l = s1.length();
-       s2 = "";
+       s2 = new StringBuilder();
        p2 = s1.indexOf(c, p1);
        while (p2 >= 0) {
-           s2 += s1.substring (p1, p2) + rs;
+           s2.append(s1.substring(p1, p2)).append(rs);
             p1 = p2 + 1;
             p2 = s1.indexOf(c, p1);
         }
         if (p1 < s1l) {
-            s2 += s1.substring(p1, s1l);
+            s2.append(s1.substring(p1, s1l));
         }
-        return s2;
+        return s2.toString();
        }       
        
     /**

Reply via email to