summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2014-06-16 17:11:07 -0400
committerBernard Normier <bernard@zeroc.com>2014-06-16 17:11:07 -0400
commit735040c89fb7c6a9c04b03043f75adb9651bb801 (patch)
treee09bcf1a9e4bf63271a1304da29fb5b4d72ac0b4
parentadding SSLEngine (diff)
downloadice-735040c89fb7c6a9c04b03043f75adb9651bb801.tar.bz2
ice-735040c89fb7c6a9c04b03043f75adb9651bb801.tar.xz
ice-735040c89fb7c6a9c04b03043f75adb9651bb801.zip
Fix for ICE-5539 (bug with trailing space in prop values) in C#, Java and JS
-rw-r--r--cpp/test/Ice/properties/Client.cpp5
-rw-r--r--cs/src/Ice/PropertiesI.cs1
-rw-r--r--cs/test/Ice/properties/Client.cs43
-rw-r--r--cs/test/Ice/properties/config/escapes.cfg35
-rw-r--r--java/src/Ice/PropertiesI.java1
-rw-r--r--java/test/Ice/properties/Client.java36
-rw-r--r--java/test/Ice/properties/config/escapes.cfg35
-rw-r--r--js/src/Ice/Properties.js1
8 files changed, 150 insertions, 7 deletions
diff --git a/cpp/test/Ice/properties/Client.cpp b/cpp/test/Ice/properties/Client.cpp
index d36a7b03f74..e165e68dca1 100644
--- a/cpp/test/Ice/properties/Client.cpp
+++ b/cpp/test/Ice/properties/Client.cpp
@@ -126,10 +126,7 @@ main(int argc, char* argv[])
} ;
for(size_t i = 0; props[i] != ""; i += 2)
- {
- cerr << "\n" << props[i] << "=\"" << props[i+1] << "\"" << endl;
- cerr << props[i] << "=\"" << properties->getProperty(props[i]) << "\"" << endl;
-
+ {
test(properties->getProperty(props[i]) == props[i + 1]);
}
diff --git a/cs/src/Ice/PropertiesI.cs b/cs/src/Ice/PropertiesI.cs
index 1665a6dd924..8359c7b3063 100644
--- a/cs/src/Ice/PropertiesI.cs
+++ b/cs/src/Ice/PropertiesI.cs
@@ -626,7 +626,6 @@ namespace Ice
break;
case '#':
- val += escapedspace;
finished = true;
break;
diff --git a/cs/test/Ice/properties/Client.cs b/cs/test/Ice/properties/Client.cs
index c47db189e44..de5f60cceda 100644
--- a/cs/test/Ice/properties/Client.cs
+++ b/cs/test/Ice/properties/Client.cs
@@ -87,6 +87,49 @@ public class Client
System.Console.Error.WriteLine(ex);
status = 1;
}
+
+ try
+ {
+ Console.Out.Write("testing configuration file escapes... ");
+ Console.Out.Flush();
+ string[] args1 = new string[]{"--Ice.Config=config/escapes.cfg"};
+ Ice.Properties properties = Ice.Util.createProperties(ref args1);
+
+ string[] props = new string[]{"Foo\tBar", "3",
+ "Foo\\tBar", "4",
+ "Escape\\ Space", "2",
+ "Prop1", "1",
+ "Prop2", "2",
+ "Prop3", "3",
+ "My Prop1", "1",
+ "My Prop2", "2",
+ "My.Prop1", "a property",
+ "My.Prop2", "a property",
+ "My.Prop3", " a property ",
+ "My.Prop4", " a property ",
+ "My.Prop5", "a \\ property",
+ "foo=bar", "1",
+ "foo#bar", "2",
+ "foo bar", "3",
+ "A", "1",
+ "B", "2 3 4",
+ "C", "5=#6",
+ "AServer", "\\\\server\\dir",
+ "BServer", "\\server\\dir",
+ ""};
+
+ for(int i = 0; props[i].Length > 0; i += 2)
+ {
+ test(properties.getProperty(props[i]).Equals(props[i + 1]));
+ }
+ Console.Out.WriteLine("ok");
+ }
+ catch(System.Exception ex)
+ {
+ System.Console.Error.WriteLine(ex);
+ status = 1;
+ }
+
return status;
}
}
diff --git a/cs/test/Ice/properties/config/escapes.cfg b/cs/test/Ice/properties/config/escapes.cfg
new file mode 100644
index 00000000000..f438d2b59c8
--- /dev/null
+++ b/cs/test/Ice/properties/config/escapes.cfg
@@ -0,0 +1,35 @@
+Foo Bar=3 #tab
+Foo\tBar=4 # embedded\t
+Escape\\ Space=2
+
+#
+# From Ice manual:
+#
+
+Prop1 = 1 # Key is "Prop1"
+ Prop2 = 2 # Key is "Prop2"
+\ Prop3 \ = 3 # Key is "Prop3"
+My Prop1 = 1 # Key is "My Prop1"
+My\ Prop2 = 2 # Key is "My Prop2"
+
+My.Prop1 = a property # Value is "a property"
+My.Prop2 = a property # Value is "a property"
+My.Prop3 = \ \ a property\ \ # Value is " a property "
+My.Prop4 = \ \ a \ \ property\ \ # Value is " a property "
+My.Prop5 = a \\ property # Value is "a \ property"
+
+foo\=bar=1 # Name is "foo=bar", value is "1"
+foo\#bar = 2 # Name is "foo#bar", value is "2"
+foo bar =3 # Name is "foo bar", value is "3"
+
+
+A=1 # Name is "A", value is "1"
+B= 2 3 4 # Name is "B", value is "2 3 4"
+C=5=\#6 # 7 # Name is "C", value is "5=#6"
+
+AServer=\\\\server\dir # Value is "\\server\dir"
+BServer=\\server\\dir # Value is "\server\dir"
+
+
+
+
diff --git a/java/src/Ice/PropertiesI.java b/java/src/Ice/PropertiesI.java
index 13566b8a917..41a341f1377 100644
--- a/java/src/Ice/PropertiesI.java
+++ b/java/src/Ice/PropertiesI.java
@@ -682,7 +682,6 @@ public final class PropertiesI implements Properties
break;
case '#':
- value += escapedspace;
finished = true;
break;
diff --git a/java/test/Ice/properties/Client.java b/java/test/Ice/properties/Client.java
index 8acc8b0569a..ccd10c7c32d 100644
--- a/java/test/Ice/properties/Client.java
+++ b/java/test/Ice/properties/Client.java
@@ -63,6 +63,42 @@ public class Client extends test.Util.Application
test(properties.getProperty("Config3").equals("Config3"));
System.out.println("ok");
}
+
+ {
+ System.out.print("testing configuration file escapes... ");
+ String[] args1 = new String[]{"--Ice.Config=config/escapes.cfg"};
+ Ice.Properties properties = Ice.Util.createProperties(args1);
+
+ String[] props = new String[]{"Foo\tBar", "3",
+ "Foo\\tBar", "4",
+ "Escape\\ Space", "2",
+ "Prop1", "1",
+ "Prop2", "2",
+ "Prop3", "3",
+ "My Prop1", "1",
+ "My Prop2", "2",
+ "My.Prop1", "a property",
+ "My.Prop2", "a property",
+ "My.Prop3", " a property ",
+ "My.Prop4", " a property ",
+ "My.Prop5", "a \\ property",
+ "foo=bar", "1",
+ "foo#bar", "2",
+ "foo bar", "3",
+ "A", "1",
+ "B", "2 3 4",
+ "C", "5=#6",
+ "AServer", "\\\\server\\dir",
+ "BServer", "\\server\\dir",
+ ""};
+
+ for(int i = 0; !props[i].isEmpty(); i += 2)
+ {
+ test(properties.getProperty(props[i]).equals(props[i + 1]));
+ }
+ System.out.println("ok");
+ }
+
return 0;
}
diff --git a/java/test/Ice/properties/config/escapes.cfg b/java/test/Ice/properties/config/escapes.cfg
new file mode 100644
index 00000000000..f438d2b59c8
--- /dev/null
+++ b/java/test/Ice/properties/config/escapes.cfg
@@ -0,0 +1,35 @@
+Foo Bar=3 #tab
+Foo\tBar=4 # embedded\t
+Escape\\ Space=2
+
+#
+# From Ice manual:
+#
+
+Prop1 = 1 # Key is "Prop1"
+ Prop2 = 2 # Key is "Prop2"
+\ Prop3 \ = 3 # Key is "Prop3"
+My Prop1 = 1 # Key is "My Prop1"
+My\ Prop2 = 2 # Key is "My Prop2"
+
+My.Prop1 = a property # Value is "a property"
+My.Prop2 = a property # Value is "a property"
+My.Prop3 = \ \ a property\ \ # Value is " a property "
+My.Prop4 = \ \ a \ \ property\ \ # Value is " a property "
+My.Prop5 = a \\ property # Value is "a \ property"
+
+foo\=bar=1 # Name is "foo=bar", value is "1"
+foo\#bar = 2 # Name is "foo#bar", value is "2"
+foo bar =3 # Name is "foo bar", value is "3"
+
+
+A=1 # Name is "A", value is "1"
+B= 2 3 4 # Name is "B", value is "2 3 4"
+C=5=\#6 # 7 # Name is "C", value is "5=#6"
+
+AServer=\\\\server\dir # Value is "\\server\dir"
+BServer=\\server\\dir # Value is "\server\dir"
+
+
+
+
diff --git a/js/src/Ice/Properties.js b/js/src/Ice/Properties.js
index 3f63204a7fa..d30588b1f20 100644
--- a/js/src/Ice/Properties.js
+++ b/js/src/Ice/Properties.js
@@ -442,7 +442,6 @@
break;
case '#':
- value += escapedspace;
finished = true;
break;