Author: jleroux
Date: Sat Dec 10 08:55:27 2011
New Revision: 1212749
URL: http://svn.apache.org/viewvc?rev=1212749&view=rev
Log:
Yesterday, late and in a hurry, I hastily committed r1212673. It was failing
after an ant clean. But I did not see, because I did not do an ant clean, and
Builbot did not report any issues (yes, I sometimes rely on it). Actually it
was because Buildbot tests fails since r1212673, and it only sends info when it
switches from bad to good, or vice-versa.
Fortunately, on my side, it was an easy fix: I just forgot to re-add the old
strToMap(String str, boolean trim) signature.
So here it is
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java?rev=1212749&r1=1212748&r2=1212749&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java Sat Dec
10 08:55:27 2011
@@ -223,13 +223,14 @@ public class StringUtil {
/**
* Creates a Map from an encoded name/value pair string
* @param str The string to decode and format
+ * @param delim the delimiter character(s) to join on (null will split on
whitespace)
* @param trim Trim whitespace off fields
* @return a Map of name/value pairs
*/
- public static Map<String, String> strToMap(String str, boolean trim) {
+ public static Map<String, String> strToMap(String str, String delim,
boolean trim) {
if (str == null) return null;
Map<String, String> decodedMap = FastMap.newInstance();
- List<String> elements = split(str, "|");
+ List<String> elements = split(str, delim);
for (String s: elements) {
List<String> e = split(s, "=");
@@ -260,12 +261,33 @@ public class StringUtil {
/**
* Creates a Map from an encoded name/value pair string
* @param str The string to decode and format
+ * @param trim Trim whitespace off fields
+ * @return a Map of name/value pairs
+ */
+ public static Map<String, String> strToMap(String str, boolean trim) {
+ return strToMap(str, "|", trim);
+ }
+
+ /**
+ * Creates a Map from an encoded name/value pair string
+ * @param str The string to decode and format
+ * @param delim the delimiter character(s) to join on (null will split on
whitespace)
+ * @return a Map of name/value pairs
+ */
+ public static Map<String, String> strToMap(String str, String delim) {
+ return strToMap(str, delim, false);
+ }
+
+ /**
+ * Creates a Map from an encoded name/value pair string
+ * @param str The string to decode and format
* @return a Map of name/value pairs
*/
public static Map<String, String> strToMap(String str) {
- return strToMap(str, false);
+ return strToMap(str, "|", false);
}
+
/**
* Creates an encoded String from a Map of name/value pairs (MUST BE
STRINGS!)
* @param map The Map of name/value pairs