summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/PropertiesI.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/src/Ice/PropertiesI.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/src/Ice/PropertiesI.cpp')
-rw-r--r--cpp/src/Ice/PropertiesI.cpp15
1 files changed, 10 insertions, 5 deletions
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())
{