summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2008-03-07 13:57:43 -0330
committerDwayne Boone <dwayne@zeroc.com>2008-03-07 13:57:43 -0330
commit0bbedfb554b897c421a2316cc681ac827f94fc4d (patch)
treea373f469b731d69a400411359672e66499773e33 /cpp
parentMinor fix (diff)
downloadice-0bbedfb554b897c421a2316cc681ac827f94fc4d.tar.bz2
ice-0bbedfb554b897c421a2316cc681ac827f94fc4d.tar.xz
ice-0bbedfb554b897c421a2316cc681ac827f94fc4d.zip
Bug 1373 - no leading/trailing whitespace for properties
Diffstat (limited to 'cpp')
-rw-r--r--cpp/CHANGES3
-rw-r--r--cpp/src/Ice/PropertiesI.cpp15
2 files changed, 13 insertions, 5 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES
index a7f0aba2589..220305fa67f 100644
--- a/cpp/CHANGES
+++ b/cpp/CHANGES
@@ -92,6 +92,9 @@ Changes since version 3.2.X (binary incompatible)
space, '#' or '=' in either the key or value string. It is necessary
to escape '#' and '=' as '\#' and '\='.
+- Properties can no longer have leading or trailing whitespace in the
+ key or the value.
+
- The following APIs were deprecated in Ice 3.1 and have been
removed:
diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp
index 5608d5715c1..2cab2878c7c 100644
--- a/cpp/src/Ice/PropertiesI.cpp
+++ b/cpp/src/Ice/PropertiesI.cpp
@@ -141,7 +141,13 @@ Ice::PropertiesI::getPropertiesForPrefix(const string& prefix)
void
Ice::PropertiesI::setProperty(const string& key, const string& value)
{
- if(key.empty())
+ //
+ // Trim whitespace
+ //
+ string currentKey = IceUtilInternal::trim(key);
+ string currentValue = IceUtilInternal::trim(value);
+
+ if(currentKey.empty())
{
return;
}
@@ -150,8 +156,7 @@ Ice::PropertiesI::setProperty(const string& key, const string& value)
// Check if the property is legal.
//
LoggerPtr logger = getProcessLogger();
- string::size_type dotPos = key.find('.');
- string currentKey = key;
+ string::size_type dotPos = currentKey.find('.');
if(dotPos != string::npos)
{
string prefix = currentKey.substr(0, dotPos);
@@ -203,9 +208,9 @@ Ice::PropertiesI::setProperty(const string& key, const string& value)
//
// Set or clear the property.
//
- if(!value.empty())
+ if(!currentValue.empty())
{
- PropertyValue pv(value, false);
+ PropertyValue pv(currentValue, false);
map<string, PropertyValue>::const_iterator p = _properties.find(currentKey);
if(p != _properties.end())
{