diff options
author | Benoit Foucher <benoit@zeroc.com> | 2009-12-20 23:00:17 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2009-12-20 23:00:17 +0100 |
commit | 1bfce436ef24da5886a752f906628472ceb60a96 (patch) | |
tree | ae4fc9bac597df81b4855a0fadbde552c978bbbf | |
parent | edits to CHANGES & RELEASE_NOTES (diff) | |
download | ice-1bfce436ef24da5886a752f906628472ceb60a96.tar.bz2 ice-1bfce436ef24da5886a752f906628472ceb60a96.tar.xz ice-1bfce436ef24da5886a752f906628472ceb60a96.zip |
Fixed bug 4514 - Ice/facets test failure
-rw-r--r-- | cpp/src/IceGrid/NodeI.cpp | 14 | ||||
-rw-r--r-- | cpp/src/IceUtil/StringUtil.cpp | 5 | ||||
-rw-r--r-- | cpp/test/Ice/facets/AllTests.cpp | 5 | ||||
-rw-r--r-- | cpp/test/IceUtil/inputUtil/Client.cpp | 13 | ||||
-rw-r--r-- | cs/src/Ice/PropertiesI.cs | 63 | ||||
-rw-r--r-- | cs/src/Ice/StringUtil.cs | 66 | ||||
-rw-r--r-- | cs/test/Ice/facets/AllTests.cs | 2 | ||||
-rw-r--r-- | cs/test/IceUtil/inputUtil/Client.cs | 59 | ||||
-rw-r--r-- | java/demo/book/map_filesystem/DirectoryI.java | 2 | ||||
-rw-r--r-- | java/src/Ice/PropertiesI.java | 61 | ||||
-rw-r--r-- | java/src/IceUtilInternal/StringUtil.java | 66 | ||||
-rw-r--r-- | java/test/Ice/facets/AllTests.java | 2 | ||||
-rw-r--r-- | java/test/IceUtil/inputUtil/Client.java | 59 |
13 files changed, 280 insertions, 137 deletions
diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp index 90066875029..120df689b6a 100644 --- a/cpp/src/IceGrid/NodeI.cpp +++ b/cpp/src/IceGrid/NodeI.cpp @@ -363,18 +363,10 @@ NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter, // // Parse the properties override property. // - string overrides = props->getProperty("IceGrid.Node.PropertiesOverride"); + vector<string> overrides = props->getPropertyAsList("IceGrid.Node.PropertiesOverride"); if(!overrides.empty()) { - const string delim = " \t\r\n"; - vector<string> overrideProps; - if(!IceUtilInternal::splitString(overrides, delim, overrideProps)) - { - Ice::Warning out(_traceLevels->logger); - out << "invalid value for property `IceGrid.Node.PropertiesOverride':\nunmatched quote"; - } - - for(vector<string>::iterator p = overrideProps.begin(); p != overrideProps.end(); ++p) + for(vector<string>::iterator p = overrides.begin(); p != overrides.end(); ++p) { if(p->find("--") != 0) { @@ -383,7 +375,7 @@ NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter, } Ice::PropertiesPtr p = Ice::createProperties(); - p->parseCommandLineOptions("", overrideProps); + p->parseCommandLineOptions("", overrides); Ice::PropertyDict propDict = p->getPropertiesForPrefix(""); for(Ice::PropertyDict::const_iterator q = propDict.begin(); q != propDict.end(); ++q) { diff --git a/cpp/src/IceUtil/StringUtil.cpp b/cpp/src/IceUtil/StringUtil.cpp index edec3076976..dbbcfa0da9f 100644 --- a/cpp/src/IceUtil/StringUtil.cpp +++ b/cpp/src/IceUtil/StringUtil.cpp @@ -329,6 +329,11 @@ IceUtilInternal::splitString(const string& str, const string& delim, vector<stri quoteChar = str[pos++]; continue; // Skip the quote } + else if(quoteChar == '\0' && str[pos] == '\\' && pos + 1 < length && + (str[pos + 1] == '\'' || str[pos + 1] == '"')) + { + ++pos; + } else if(quoteChar != '\0' && str[pos] == '\\' && pos + 1 < length && str[pos + 1] == quoteChar) { ++pos; diff --git a/cpp/test/Ice/facets/AllTests.cpp b/cpp/test/Ice/facets/AllTests.cpp index 747889ea21b..5d39586360b 100644 --- a/cpp/test/Ice/facets/AllTests.cpp +++ b/cpp/test/Ice/facets/AllTests.cpp @@ -27,12 +27,13 @@ allTests(const Ice::CommunicatorPtr& communicator) communicator->getProperties()->setProperty("Ice.Admin.Facets", "foobar"); Ice::StringSeq facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets"); test(facetFilter.size() == 1 && facetFilter[0] == "foobar"); - communicator->getProperties()->setProperty("Ice.Admin.Facets", "foo'bar"); + communicator->getProperties()->setProperty("Ice.Admin.Facets", "foo\\'bar"); facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets"); test(facetFilter.size() == 1 && facetFilter[0] == "foo'bar"); communicator->getProperties()->setProperty("Ice.Admin.Facets", "'foo bar' toto 'titi'"); facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets"); - test(facetFilter.size() == 3 && facetFilter[0] == "foo bar" && facetFilter[1] == "toto" && facetFilter[2] == "titi"); + test(facetFilter.size() == 3 && facetFilter[0] == "foo bar" && facetFilter[1] == "toto" && + facetFilter[2] == "titi"); communicator->getProperties()->setProperty("Ice.Admin.Facets", "'foo bar\\' toto' 'titi'"); facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets"); test(facetFilter.size() == 2 && facetFilter[0] == "foo bar' toto" && facetFilter[1] == "titi"); diff --git a/cpp/test/IceUtil/inputUtil/Client.cpp b/cpp/test/IceUtil/inputUtil/Client.cpp index 8341b43ecea..4a710f7f56d 100644 --- a/cpp/test/IceUtil/inputUtil/Client.cpp +++ b/cpp/test/IceUtil/inputUtil/Client.cpp @@ -231,6 +231,19 @@ main(int, char**) test(IceUtilInternal::splitString("\"'a\"", ":", ss) && ss.size() == 1 && ss[0] == "'a"); ss.clear(); + test(IceUtilInternal::splitString("a\\'b", ":", ss) && ss.size() == 1 && ss[0] == "a'b"); + ss.clear(); + test(IceUtilInternal::splitString("'a:b\\'c'", ":", ss) && ss.size() == 1 && ss[0] == "a:b'c"); + ss.clear(); + test(IceUtilInternal::splitString("a\\\"b", ":", ss) && ss.size() == 1 && ss[0] == "a\"b"); + ss.clear(); + test(IceUtilInternal::splitString("\"a:b\\\"c\"", ":", ss) && ss.size() == 1 && ss[0] == "a:b\"c"); + ss.clear(); + test(IceUtilInternal::splitString("'a:b\"c'", ":", ss) && ss.size() == 1 && ss[0] == "a:b\"c"); + ss.clear(); + test(IceUtilInternal::splitString("\"a:b'c\"", ":", ss) && ss.size() == 1 && ss[0] == "a:b'c"); + ss.clear(); + test(!IceUtilInternal::splitString("a\"b", ":", ss)); } cout << "ok" << endl; diff --git a/cs/src/Ice/PropertiesI.cs b/cs/src/Ice/PropertiesI.cs index 27e3604b114..8b8b076d83f 100644 --- a/cs/src/Ice/PropertiesI.cs +++ b/cs/src/Ice/PropertiesI.cs @@ -121,7 +121,7 @@ namespace Ice { pv.used = true; - string[] result = splitString(pv.val, ", \t\r\n"); + string[] result = IceUtilInternal.StringUtil.splitString(pv.val, ", \t\r\n"); if(result == null) { Ice.Util.getProcessLogger().warning("mismatched quotes in property " + key @@ -646,66 +646,7 @@ namespace Ice } _properties["Ice.Config"] = new PropertyValue(val, true); - } - - // - // Split string helper; returns null for unmatched quotes - // - private string[] splitString(string str, string delim) - { - ArrayList l = new ArrayList(); - char[] arr = new char[str.Length]; - int pos = 0; - - while(pos < str.Length) - { - int n = 0; - char quoteChar = '\0'; - if(str[pos] == '"' || str[pos] == '\'') - { - quoteChar = str[pos]; - ++pos; - } - while(pos < str.Length) - { - if(quoteChar != '\0' && str[pos] == '\\' && pos + 1 < str.Length && str[pos + 1] == quoteChar) - { - ++pos; - } - else if(quoteChar != '\0' && str[pos] == quoteChar) - { - ++pos; - quoteChar = '\0'; - break; - } - else if(delim.IndexOf(str[pos]) != -1) - { - if(quoteChar == '\0') - { - ++pos; - break; - } - } - - if(pos < str.Length) - { - arr[n++] = str[pos++]; - } - } - if(quoteChar != '\0') - { - return null; // Unmatched quote. - } - if(n > 0) - { - l.Add(new string(arr, 0, n)); - } - } - - return (string[])l.ToArray(typeof(string)); - } - - + } private Hashtable _properties; } diff --git a/cs/src/Ice/StringUtil.cs b/cs/src/Ice/StringUtil.cs index 9db9c17c697..fec68771cf4 100644 --- a/cs/src/Ice/StringUtil.cs +++ b/cs/src/Ice/StringUtil.cs @@ -9,6 +9,7 @@ using System.Text; using System.Diagnostics; +using System.Collections.Generic; namespace IceUtilInternal { @@ -355,6 +356,71 @@ namespace IceUtilInternal return utf8.GetString(arr); // May raise ArgumentException. } + // + // Split string helper; returns null for unmatched quotes + // + static public string[] splitString(string str, string delim) + { + List<string> l = new List<string>(); + char[] arr = new char[str.Length]; + int pos = 0; + + int n = 0; + char quoteChar = '\0'; + while(pos < str.Length) + { + if(quoteChar == '\0' && (str[pos] == '"' || str[pos] == '\'')) + { + quoteChar = str[pos++]; + continue; // Skip the quote. + } + else if(quoteChar == '\0' && str[pos] == '\\' && pos + 1 < str.Length && + (str[pos + 1] == '\'' || str[pos + 1] == '"')) + { + ++pos; // Skip the backslash + } + else if(quoteChar != '\0' && str[pos] == '\\' && pos + 1 < str.Length && str[pos + 1] == quoteChar) + { + ++pos; // Skip the backslash + } + else if(quoteChar != '\0' && str[pos] == quoteChar) + { + ++pos; + quoteChar = '\0'; + continue; // Skip the quote. + } + else if(delim.IndexOf(str[pos]) != -1) + { + if(quoteChar == '\0') + { + ++pos; + if(n > 0) + { + l.Add(new string(arr, 0, n)); + n = 0; + } + continue; + } + } + + if(pos < str.Length) + { + arr[n++] = str[pos++]; + } + + } + + if(n > 0) + { + l.Add(new string(arr, 0, n)); + } + if(quoteChar != '\0') + { + return null; // Unmatched quote. + } + return l.ToArray(); + } + public static int checkQuote(string s) { return checkQuote(s, 0); diff --git a/cs/test/Ice/facets/AllTests.cs b/cs/test/Ice/facets/AllTests.cs index 1b0e64d0a7e..035a172c8b6 100644 --- a/cs/test/Ice/facets/AllTests.cs +++ b/cs/test/Ice/facets/AllTests.cs @@ -29,7 +29,7 @@ public class AllTests communicator.getProperties().setProperty("Ice.Admin.Facets", "foobar"); String[] facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets"); test(facetFilter.Length == 1 && facetFilter[0].Equals("foobar")); - communicator.getProperties().setProperty("Ice.Admin.Facets", "foo'bar"); + communicator.getProperties().setProperty("Ice.Admin.Facets", "foo\\'bar"); facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets"); test(facetFilter.Length == 1 && facetFilter[0].Equals("foo'bar")); communicator.getProperties().setProperty("Ice.Admin.Facets", "'foo bar' toto 'titi'"); diff --git a/cs/test/IceUtil/inputUtil/Client.cs b/cs/test/IceUtil/inputUtil/Client.cs index e8cbd8e5be9..98d7ed4a9d1 100644 --- a/cs/test/IceUtil/inputUtil/Client.cs +++ b/cs/test/IceUtil/inputUtil/Client.cs @@ -107,5 +107,64 @@ public class Client } System.Console.Out.WriteLine("ok"); + + System.Console.Out.Write("checking string splitting... "); + System.Console.Out.Flush(); + { + string[] arr; + + arr = IceUtilInternal.StringUtil.splitString("", ""); + test(arr.Length == 0); + arr = IceUtilInternal.StringUtil.splitString("", ":"); + test(arr.Length == 0); + arr = IceUtilInternal.StringUtil.splitString("a", ""); + test(arr.Length == 1 && arr[0].Equals("a")); + arr = IceUtilInternal.StringUtil.splitString("a", ":"); + test(arr.Length == 1 && arr[0].Equals("a")); + arr = IceUtilInternal.StringUtil.splitString("ab", ""); + test(arr.Length == 1 && arr[0].Equals("ab")); + arr = IceUtilInternal.StringUtil.splitString("ab:", ":"); + test(arr.Length == 1 && arr[0].Equals("ab")); + arr = IceUtilInternal.StringUtil.splitString(":ab", ":"); + test(arr.Length == 1 && arr[0].Equals("ab")); + arr = IceUtilInternal.StringUtil.splitString("a:b", ":"); + test(arr.Length == 2 && arr[0].Equals("a") && arr[1].Equals("b")); + arr = IceUtilInternal.StringUtil.splitString(":a:b:", ":"); + test(arr.Length == 2 && arr[0].Equals("a") && arr[1].Equals("b")); + + arr = IceUtilInternal.StringUtil.splitString("\"a\"", ":"); + test(arr.Length == 1 && arr[0].Equals("a")); + arr = IceUtilInternal.StringUtil.splitString("\"a\":b", ":"); + test(arr.Length == 2 && arr[0].Equals("a") && arr[1].Equals("b")); + arr = IceUtilInternal.StringUtil.splitString("\"a\":\"b\"", ":"); + test(arr.Length == 2 && arr[0].Equals("a") && arr[1].Equals("b")); + arr = IceUtilInternal.StringUtil.splitString("\"a:b\"", ":"); + test(arr.Length == 1 && arr[0].Equals("a:b")); + arr = IceUtilInternal.StringUtil.splitString("a=\"a:b\"", ":"); + test(arr.Length == 1 && arr[0].Equals("a=a:b")); + + arr = IceUtilInternal.StringUtil.splitString("'a'", ":"); + test(arr.Length == 1 && arr[0].Equals("a")); + arr = IceUtilInternal.StringUtil.splitString("'\"a'", ":"); + test(arr.Length == 1 && arr[0].Equals("\"a")); + arr = IceUtilInternal.StringUtil.splitString("\"'a\"", ":"); + test(arr.Length == 1 && arr[0].Equals("'a")); + + arr = IceUtilInternal.StringUtil.splitString("a\\'b", ":"); + test(arr.Length == 1 && arr[0].Equals("a'b")); + arr = IceUtilInternal.StringUtil.splitString("'a:b\\'c'", ":"); + test(arr.Length == 1 && arr[0].Equals("a:b'c")); + arr = IceUtilInternal.StringUtil.splitString("a\\\"b", ":"); + test(arr.Length == 1 && arr[0].Equals("a\"b")); + arr = IceUtilInternal.StringUtil.splitString("\"a:b\\\"c\"", ":"); + test(arr.Length == 1 && arr[0].Equals("a:b\"c")); + arr = IceUtilInternal.StringUtil.splitString("'a:b\"c'", ":"); + test(arr.Length == 1 && arr[0].Equals("a:b\"c")); + arr = IceUtilInternal.StringUtil.splitString("\"a:b'c\"", ":"); + test(arr.Length == 1 && arr[0].Equals("a:b'c")); + + test(IceUtilInternal.StringUtil.splitString("a\"b", ":") == null); + } + System.Console.Out.WriteLine("ok"); } } diff --git a/java/demo/book/map_filesystem/DirectoryI.java b/java/demo/book/map_filesystem/DirectoryI.java index 0c54e9faf0b..2d8c701f2c0 100644 --- a/java/demo/book/map_filesystem/DirectoryI.java +++ b/java/demo/book/map_filesystem/DirectoryI.java @@ -324,7 +324,7 @@ public class DirectoryI extends _DirectoryDisp { throw new Ice.ObjectNotExistException(); } - if(entry.parent.name.isEmpty()) + if(entry.parent.name.length() == 0) { throw new PermissionDenied("Cannot destroy root directory"); } diff --git a/java/src/Ice/PropertiesI.java b/java/src/Ice/PropertiesI.java index 70682ee2a50..fcdba281f71 100644 --- a/java/src/Ice/PropertiesI.java +++ b/java/src/Ice/PropertiesI.java @@ -106,7 +106,7 @@ public final class PropertiesI implements Properties { pv.used = true; - String[] result = splitString(pv.value, ", \t\r\n"); + String[] result = IceUtilInternal.StringUtil.splitString(pv.value, ", \t\r\n"); if(result == null) { Ice.Util.getProcessLogger().warning("mismatched quotes in property " + key @@ -715,64 +715,5 @@ public final class PropertiesI implements Properties _properties.put("Ice.Config", new PropertyValue(value, true)); } - // - // Split string helper; returns null for unmatched quotes - // - private String[] - splitString(String str, String delim) - { - java.util.List<String> l = new java.util.ArrayList<String>(); - char[] arr = new char[str.length()]; - int pos = 0; - - while(pos < str.length()) - { - int n = 0; - char quoteChar = '\0'; - if(str.charAt(pos) == '"' || str.charAt(pos) == '\'') - { - quoteChar = str.charAt(pos); - ++pos; - } - while(pos < str.length()) - { - if(quoteChar != '\0' && str.charAt(pos) == '\\' && pos + 1 < str.length() && - str.charAt(pos + 1) == quoteChar) - { - ++pos; - } - else if(quoteChar != '\0' && str.charAt(pos) == quoteChar) - { - ++pos; - quoteChar = '\0'; - break; - } - else if(delim.indexOf(str.charAt(pos)) != -1) - { - if(quoteChar == '\0') - { - ++pos; - break; - } - } - - if(pos < str.length()) - { - arr[n++] = str.charAt(pos++); - } - } - if(quoteChar != '\0') - { - return null; // Unmatched quote. - } - if(n > 0) - { - l.add(new String(arr, 0, n)); - } - } - - return (String[])l.toArray(new String[0]); - } - private java.util.HashMap<String, PropertyValue> _properties = new java.util.HashMap<String, PropertyValue>(); } diff --git a/java/src/IceUtilInternal/StringUtil.java b/java/src/IceUtilInternal/StringUtil.java index 137bb234e06..dfbb095673f 100644 --- a/java/src/IceUtilInternal/StringUtil.java +++ b/java/src/IceUtilInternal/StringUtil.java @@ -386,6 +386,72 @@ public final class StringUtil return s.toString(); } + // + // Split string helper; returns null for unmatched quotes + // + static public String[] + splitString(String str, String delim) + { + java.util.List<String> l = new java.util.ArrayList<String>(); + char[] arr = new char[str.length()]; + int pos = 0; + + int n = 0; + char quoteChar = '\0'; + while(pos < str.length()) + { + if(quoteChar == '\0' && (str.charAt(pos) == '"' || str.charAt(pos) == '\'')) + { + quoteChar = str.charAt(pos++); + continue; // Skip the quote. + } + else if(quoteChar == '\0' && str.charAt(pos) == '\\' && pos + 1 < str.length() && + (str.charAt(pos + 1) == '"' || str.charAt(pos + 1) == '\'')) + { + ++pos; // Skip the backslash + } + else if(quoteChar != '\0' && str.charAt(pos) == '\\' && pos + 1 < str.length() && + str.charAt(pos + 1) == quoteChar) + { + ++pos; // Skip the backslash + } + else if(quoteChar != '\0' && str.charAt(pos) == quoteChar) + { + ++pos; + quoteChar = '\0'; + continue; // Skip the quote. + } + else if(delim.indexOf(str.charAt(pos)) != -1) + { + if(quoteChar == '\0') + { + ++pos; + if(n > 0) + { + l.add(new String(arr, 0, n)); + n = 0; + } + continue; + } + } + + if(pos < str.length()) + { + arr[n++] = str.charAt(pos++); + } + } + + if(n > 0) + { + l.add(new String(arr, 0, n)); + } + if(quoteChar != '\0') + { + return null; // Unmatched quote. + } + return (String[])l.toArray(new String[0]); + } + public static int checkQuote(String s) { diff --git a/java/test/Ice/facets/AllTests.java b/java/test/Ice/facets/AllTests.java index 252a60f16dd..ea2e0971b9d 100644 --- a/java/test/Ice/facets/AllTests.java +++ b/java/test/Ice/facets/AllTests.java @@ -40,7 +40,7 @@ public class AllTests communicator.getProperties().setProperty("Ice.Admin.Facets", "foobar"); String[] facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets"); test(facetFilter.length == 1 && facetFilter[0].equals("foobar")); - communicator.getProperties().setProperty("Ice.Admin.Facets", "foo'bar"); + communicator.getProperties().setProperty("Ice.Admin.Facets", "foo\\'bar"); facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets"); test(facetFilter.length == 1 && facetFilter[0].equals("foo'bar")); communicator.getProperties().setProperty("Ice.Admin.Facets", "'foo bar' toto 'titi'"); diff --git a/java/test/IceUtil/inputUtil/Client.java b/java/test/IceUtil/inputUtil/Client.java index 24af63cda39..f8b4e64b0de 100644 --- a/java/test/IceUtil/inputUtil/Client.java +++ b/java/test/IceUtil/inputUtil/Client.java @@ -106,5 +106,64 @@ public class Client } System.out.println("ok"); + + System.out.print("checking string splitting... "); + System.out.flush(); + { + String[] arr; + + arr = IceUtilInternal.StringUtil.splitString("", ""); + test(arr.length == 0); + arr = IceUtilInternal.StringUtil.splitString("", ":"); + test(arr.length == 0); + arr = IceUtilInternal.StringUtil.splitString("a", ""); + test(arr.length == 1 && arr[0].equals("a")); + arr = IceUtilInternal.StringUtil.splitString("a", ":"); + test(arr.length == 1 && arr[0].equals("a")); + arr = IceUtilInternal.StringUtil.splitString("ab", ""); + test(arr.length == 1 && arr[0].equals("ab")); + arr = IceUtilInternal.StringUtil.splitString("ab:", ":"); + test(arr.length == 1 && arr[0].equals("ab")); + arr = IceUtilInternal.StringUtil.splitString(":ab", ":"); + test(arr.length == 1 && arr[0].equals("ab")); + arr = IceUtilInternal.StringUtil.splitString("a:b", ":"); + test(arr.length == 2 && arr[0].equals("a") && arr[1].equals("b")); + arr = IceUtilInternal.StringUtil.splitString(":a:b:", ":"); + test(arr.length == 2 && arr[0].equals("a") && arr[1].equals("b")); + + arr = IceUtilInternal.StringUtil.splitString("\"a\"", ":"); + test(arr.length == 1 && arr[0].equals("a")); + arr = IceUtilInternal.StringUtil.splitString("\"a\":b", ":"); + test(arr.length == 2 && arr[0].equals("a") && arr[1].equals("b")); + arr = IceUtilInternal.StringUtil.splitString("\"a\":\"b\"", ":"); + test(arr.length == 2 && arr[0].equals("a") && arr[1].equals("b")); + arr = IceUtilInternal.StringUtil.splitString("\"a:b\"", ":"); + test(arr.length == 1 && arr[0].equals("a:b")); + arr = IceUtilInternal.StringUtil.splitString("a=\"a:b\"", ":"); + test(arr.length == 1 && arr[0].equals("a=a:b")); + + arr = IceUtilInternal.StringUtil.splitString("'a'", ":"); + test(arr.length == 1 && arr[0].equals("a")); + arr = IceUtilInternal.StringUtil.splitString("'\"a'", ":"); + test(arr.length == 1 && arr[0].equals("\"a")); + arr = IceUtilInternal.StringUtil.splitString("\"'a\"", ":"); + test(arr.length == 1 && arr[0].equals("'a")); + + arr = IceUtilInternal.StringUtil.splitString("a\\'b", ":"); + test(arr.length == 1 && arr[0].equals("a'b")); + arr = IceUtilInternal.StringUtil.splitString("'a:b\\'c'", ":"); + test(arr.length == 1 && arr[0].equals("a:b'c")); + arr = IceUtilInternal.StringUtil.splitString("a\\\"b", ":"); + test(arr.length == 1 && arr[0].equals("a\"b")); + arr = IceUtilInternal.StringUtil.splitString("\"a:b\\\"c\"", ":"); + test(arr.length == 1 && arr[0].equals("a:b\"c")); + arr = IceUtilInternal.StringUtil.splitString("'a:b\"c'", ":"); + test(arr.length == 1 && arr[0].equals("a:b\"c")); + arr = IceUtilInternal.StringUtil.splitString("\"a:b'c\"", ":"); + test(arr.length == 1 && arr[0].equals("a:b'c")); + + test(IceUtilInternal.StringUtil.splitString("a\"b", ":") == null); + } + System.out.println("ok"); } } |