You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2017/11/25 11:18:38 UTC

svn commit: r1816281 - /jmeter/trunk/src/functions/org/apache/jmeter/functions/CSVRead.java

Author: fschumacher
Date: Sat Nov 25 11:18:38 2017
New Revision: 1816281

URL: http://svn.apache.org/viewvc?rev=1816281&view=rev
Log:
Use format strings for log messages and guard those log statements, that might call functions.

Modified:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/CSVRead.java

Modified: jmeter/trunk/src/functions/org/apache/jmeter/functions/CSVRead.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/CSVRead.java?rev=1816281&r1=1816280&r2=1816281&view=diff
==============================================================================
--- jmeter/trunk/src/functions/org/apache/jmeter/functions/CSVRead.java (original)
+++ jmeter/trunk/src/functions/org/apache/jmeter/functions/CSVRead.java Sat Nov 25 11:18:38 2017
@@ -80,9 +80,7 @@ public class CSVRead extends AbstractFun
         String fileName = ((org.apache.jmeter.engine.util.CompoundVariable) values[0]).execute();
         String columnOrNext = ((org.apache.jmeter.engine.util.CompoundVariable) values[1]).execute();
 
-        if (log.isDebugEnabled()) {
-            log.debug("execute (" + fileName + " , " + columnOrNext + ")   ");
-        }
+        log.debug("execute ({}, {})   ", fileName, columnOrNext);
 
         // Process __CSVRead(filename,*ALIAS)
         if (columnOrNext.startsWith("*")) { //$NON-NLS-1$
@@ -114,16 +112,16 @@ public class CSVRead extends AbstractFun
                                                                 // is wanted?
             myValue = FileWrapper.getColumn(fileName, columnIndex);
         } catch (NumberFormatException e) {
-            log.warn(Thread.currentThread().getName() + " - can't parse column number: " + columnOrNext + " "
-                    + e.toString());
+            log.warn("{} - can't parse column number: {} {}",
+                    Thread.currentThread().getName(), columnOrNext,
+                    e.toString());
         } catch (IndexOutOfBoundsException e) {
-            log.warn(Thread.currentThread().getName() + " - invalid column number: " + columnOrNext + " at row "
-                    + FileWrapper.getCurrentRow(fileName) + " " + e.toString());
+            log.warn("{} - invalid column number: {} at row {} {}",
+                    Thread.currentThread().getName(), columnOrNext,
+                    FileWrapper.getCurrentRow(fileName), e.toString());
         }
 
-        if (log.isDebugEnabled()) {
-            log.debug("execute value: " + myValue);
-        }
+        log.debug("execute value: {}");
 
         return myValue;
     }
@@ -143,13 +141,15 @@ public class CSVRead extends AbstractFun
     /** {@inheritDoc} */
     @Override
     public void setParameters(Collection<CompoundVariable> parameters) throws InvalidVariableException {
-        log.debug("setParameter - Collection.size=" + parameters.size());
+        if (log.isDebugEnabled()) {
+            log.debug("setParameter - Collection.size={}", parameters.size());
+        }
 
         values = parameters.toArray();
 
         if (log.isDebugEnabled()) {
             for (int i = 0; i < parameters.size(); i++) {
-                log.debug("i:" + ((CompoundVariable) values[i]).execute());
+                log.debug("i: {}", ((CompoundVariable) values[i]).execute());
             }
         }