jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1380209 - in /jmeter/trunk/src: jorphan/org/apache/jorphan/util/JOrphanUtils.java protocol/native/org/apache/jmeter/protocol/system/NativeCommand.java
Date Mon, 03 Sep 2012 11:31:47 GMT
Author: pmouawad
Date: Mon Sep  3 11:31:45 2012
New Revision: 1380209

URL: http://svn.apache.org/viewvc?rev=1380209&view=rev
Log:
Factor in JOrphanUtils useful method

Modified:
    jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java
    jmeter/trunk/src/protocol/native/org/apache/jmeter/protocol/system/NativeCommand.java

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java?rev=1380209&r1=1380208&r2=1380209&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java (original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java Mon Sep  3 11:31:45
2012
@@ -493,4 +493,20 @@ public final class JOrphanUtils {
             }
         }
     }
-}
+    
+    /**
+     * Returns null if input is empty, null or contains spaces
+     * @param input String
+     * @return String
+     */
+    public static final String nullifyIfEmptyTrimmed(String input) {
+        if (input == null) {
+            return null;
+        }
+        String trimmed = input.trim();
+        if (trimmed.length() == 0) {
+            return null;
+        }
+        return trimmed;
+    }
+}
\ No newline at end of file

Modified: jmeter/trunk/src/protocol/native/org/apache/jmeter/protocol/system/NativeCommand.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/native/org/apache/jmeter/protocol/system/NativeCommand.java?rev=1380209&r1=1380208&r2=1380209&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/native/org/apache/jmeter/protocol/system/NativeCommand.java
(original)
+++ jmeter/trunk/src/protocol/native/org/apache/jmeter/protocol/system/NativeCommand.java
Mon Sep  3 11:31:45 2012
@@ -26,6 +26,8 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.jorphan.util.JOrphanUtils;
+
 /**
  * Native Command 
  */
@@ -51,9 +53,9 @@ public class NativeCommand {
         super();
         this.directory = directory;
         this.env = env;
-        this.stdin = nonEmpty(stdin);
-        this.stdout = nonEmpty(stdout);
-        this.stderr = nonEmpty(stderr);
+        this.stdin = JOrphanUtils.nullifyIfEmptyTrimmed(stdin);
+        this.stdout = JOrphanUtils.nullifyIfEmptyTrimmed(stdout);
+        this.stderr = JOrphanUtils.nullifyIfEmptyTrimmed(stderr);
     }
 
 	/**
@@ -141,15 +143,4 @@ public class NativeCommand {
     public Map<String, String> getExecutionEnvironment() {
         return executionEnvironment;
     }
-
-    private String nonEmpty(String input) {
-        if (input == null) {
-            return null;
-        }
-        String trimmed = input.trim();
-        if (trimmed.length() == 0) {
-            return null;
-        }
-        return trimmed;
-    }
-}
+}
\ No newline at end of file



Mime
View raw message