jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1843695 - in /jmeter/trunk/src: components/org/apache/jmeter/assertions/ components/org/apache/jmeter/extractor/ functions/org/apache/jmeter/functions/
Date Fri, 12 Oct 2018 19:53:33 GMT
Author: fschumacher
Date: Fri Oct 12 19:53:33 2018
New Revision: 1843695

URL: http://svn.apache.org/viewvc?rev=1843695&view=rev
Log:
Use simpler code for "static" String concatenation

Closes #403 on github

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/assertions/XPathAssertion.java
    jmeter/trunk/src/components/org/apache/jmeter/extractor/RegexExtractor.java
    jmeter/trunk/src/components/org/apache/jmeter/extractor/XPath2Extractor.java
    jmeter/trunk/src/components/org/apache/jmeter/extractor/XPathExtractor.java
    jmeter/trunk/src/functions/org/apache/jmeter/functions/XPathFileContainer.java

Modified: jmeter/trunk/src/components/org/apache/jmeter/assertions/XPathAssertion.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/XPathAssertion.java?rev=1843695&r1=1843694&r2=1843695&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/assertions/XPathAssertion.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/assertions/XPathAssertion.java Fri Oct 12
19:53:33 2018
@@ -104,18 +104,17 @@ public class XPathAssertion extends Abst
         } catch (SAXException e) {
             log.debug("Caught sax exception.", e);
             result.setError(true);
-            result.setFailureMessage(new StringBuilder("SAXException: ").append(e.getMessage()).toString());
+            result.setFailureMessage("SAXException: " + e.getMessage());
             return result;
         } catch (IOException e) {
             log.warn("Cannot parse result content.", e);
             result.setError(true);
-            result.setFailureMessage(new StringBuilder("IOException: ").append(e.getMessage()).toString());
+            result.setFailureMessage("IOException: " + e.getMessage());
             return result;
         } catch (ParserConfigurationException e) {
             log.warn("Cannot parse result content.", e);
             result.setError(true);
-            result.setFailureMessage(new StringBuilder("ParserConfigurationException: ").append(e.getMessage())
-                    .toString());
+            result.setFailureMessage("ParserConfigurationException: " + e.getMessage());
             return result;
         } catch (TidyException e) {
             result.setError(true);

Modified: jmeter/trunk/src/components/org/apache/jmeter/extractor/RegexExtractor.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/extractor/RegexExtractor.java?rev=1843695&r1=1843694&r2=1843695&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/extractor/RegexExtractor.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/extractor/RegexExtractor.java Fri Oct 12
19:53:33 2018
@@ -153,7 +153,7 @@ public class RegexExtractor extends Abst
                     for (int i = 1; i <= matchCount; i++) {
                         match = getCorrectMatch(matches, i);
                         if (match != null) {
-                            final String refName_n = new StringBuilder(refName).append(UNDERSCORE).append(i).toString();
+                            final String refName_n = refName + UNDERSCORE + i;
                             vars.put(refName_n, generateResult(match));
                             saveGroups(vars, refName_n, match);
                         }
@@ -161,7 +161,7 @@ public class RegexExtractor extends Abst
                 }
                 // Remove any left-over variables
                 for (int i = matchCount + 1; i <= prevCount; i++) {
-                    final String refName_n = new StringBuilder(refName).append(UNDERSCORE).append(i).toString();
+                    final String refName_n = refName + UNDERSCORE + i;
                     vars.remove(refName_n);
                     removeGroups(vars, refName_n);
                 }

Modified: jmeter/trunk/src/components/org/apache/jmeter/extractor/XPath2Extractor.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/extractor/XPath2Extractor.java?rev=1843695&r1=1843694&r2=1843695&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/extractor/XPath2Extractor.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/extractor/XPath2Extractor.java Fri Oct 12
19:53:33 2018
@@ -75,11 +75,11 @@ PostProcessor, Serializable {
     //- JMX file attributes
 
     private String concat(String s1,String s2){
-        return new StringBuilder(s1).append("_").append(s2).toString(); // $NON-NLS-1$
+        return s1 + "_" + s2; // $NON-NLS-1$
     }
 
     private String concat(String s1, int i){
-        return new StringBuilder(s1).append("_").append(i).toString(); // $NON-NLS-1$
+        return s1 + "_" + i; // $NON-NLS-1$
     }
 
 

Modified: jmeter/trunk/src/components/org/apache/jmeter/extractor/XPathExtractor.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/extractor/XPathExtractor.java?rev=1843695&r1=1843694&r2=1843695&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/extractor/XPathExtractor.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/extractor/XPathExtractor.java Fri Oct 12
19:53:33 2018
@@ -91,11 +91,11 @@ public class XPathExtractor extends Abst
 
 
     private String concat(String s1,String s2){
-        return new StringBuilder(s1).append("_").append(s2).toString(); // $NON-NLS-1$
+        return s1 + "_" + s2; // $NON-NLS-1$
     }
 
     private String concat(String s1, int i){
-        return new StringBuilder(s1).append("_").append(i).toString(); // $NON-NLS-1$
+        return s1 + "_" + i; // $NON-NLS-1$
     }
 
     /**
@@ -169,7 +169,7 @@ public class XPathExtractor extends Abst
             log.error("IOException on ({})", getXPathQuery(), e);
             AssertionResult ass = new AssertionResult(getName());
             ass.setError(true);
-            ass.setFailureMessage(new StringBuilder("IOException: ").append(e.getLocalizedMessage()).toString());
+            ass.setFailureMessage("IOException: " + e.getLocalizedMessage());
             previousResult.addAssertionResult(ass);
             previousResult.setSuccessful(false);
         } catch (ParserConfigurationException e) {// Should not happen

Modified: jmeter/trunk/src/functions/org/apache/jmeter/functions/XPathFileContainer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/XPathFileContainer.java?rev=1843695&r1=1843694&r2=1843695&view=diff
==============================================================================
--- jmeter/trunk/src/functions/org/apache/jmeter/functions/XPathFileContainer.java (original)
+++ jmeter/trunk/src/functions/org/apache/jmeter/functions/XPathFileContainer.java Fri Oct
12 19:53:33 2018
@@ -56,9 +56,7 @@ public class XPathFileContainer {
 
     public XPathFileContainer(String file, String xpath) throws FileNotFoundException, IOException,
             ParserConfigurationException, SAXException, TransformerException {
-        if(log.isDebugEnabled()) {
-            log.debug("XPath(" + file + ") xpath " + xpath);
-        }
+        log.debug("XPath({}) xpath {}", file, xpath);
         fileName = file;
         nextRow = 0;
         nodeList=load(xpath);
@@ -72,7 +70,7 @@ public class XPathFileContainer {
             DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
             nl = XPathUtil.selectNodeList(builder.parse(bis), xpath);
             if(log.isDebugEnabled()) {
-                log.debug("found " + nl.getLength());
+                log.debug("found {}", nl.getLength());
             }
         } catch (TransformerException | SAXException
                 | ParserConfigurationException | IOException e) {
@@ -100,7 +98,7 @@ public class XPathFileContainer {
         {
             nextRow = 0;
         }
-        log.debug(new StringBuilder("Row: ").append(row).toString());
+        log.debug("Row: {}", row);
         return row;
     }
 



Mime
View raw message