jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1854569 - in /jmeter/trunk/src: core/org/apache/jmeter/util/JMeterUtils.java jorphan/org/apache/jorphan/util/JOrphanUtils.java
Date Fri, 01 Mar 2019 09:57:53 GMT
Author: pmouawad
Date: Fri Mar  1 09:57:52 2019
New Revision: 1854569

URL: http://svn.apache.org/viewvc?rev=1854569&view=rev
Log:
Fix the TODO

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java
    jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java?rev=1854569&r1=1854568&r2=1854569&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java Fri Mar  1 09:57:52 2019
@@ -942,20 +942,11 @@ public class JMeterUtils implements Unit
      * @param splitChar
      *            Object to unsplit the strings with.
      * @return Array of all the tokens.
+     * @deprecated use {@link JOrphanUtils#unsplit(Object[], Object)}
      */
-    //TODO - move to JOrphanUtils?
+    @Deprecated
     public static String unsplit(Object[] splittee, Object splitChar) {
-        StringBuilder retVal = new StringBuilder();
-        int count = -1;
-        while (++count < splittee.length) {
-            if (splittee[count] != null) {
-                retVal.append(splittee[count]);
-            }
-            if (count + 1 < splittee.length && splittee[count + 1] != null) {
-                retVal.append(splitChar);
-            }
-        }
-        return retVal.toString();
+        return JOrphanUtils.unsplit(splittee, splitChar);
     }
 
     // End Method

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=1854569&r1=1854568&r2=1854569&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java (original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java Fri Mar  1 09:57:52
2019
@@ -738,4 +738,29 @@ public final class JOrphanUtils {
         setter.accept((String) result[0]);
         return nbReplaced;
     }
+    
+    /**
+     * Takes an array of strings and a tokenizer character, and returns a string
+     * of all the strings concatenated with the tokenizer string in between each
+     * one.
+     *
+     * @param splittee
+     *            Array of Objects to be concatenated.
+     * @param splitChar
+     *            Object to unsplit the strings with.
+     * @return Array of all the tokens.
+     */
+    public static String unsplit(Object[] splittee, Object splitChar) {
+        StringBuilder retVal = new StringBuilder();
+        int count = -1;
+        while (++count < splittee.length) {
+            if (splittee[count] != null) {
+                retVal.append(splittee[count]);
+            }
+            if (count + 1 < splittee.length && splittee[count + 1] != null) {
+                retVal.append(splitChar);
+            }
+        }
+        return retVal.toString();
+    }
 }



Mime
View raw message