diff options
author | Benoit Foucher <benoit@zeroc.com> | 2009-12-18 21:13:09 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2009-12-18 21:13:09 +0100 |
commit | aa6809bd9431b5cc3952d6a6e2abde76b2bf003c (patch) | |
tree | 0da37ff519b9a3b6effbd1583b61abbf6f132c2a /cpp/src/IceGrid/NodeI.cpp | |
parent | http://bugzilla/bugzilla/show_bug.cgi?id=4509 - parallel build issues. (diff) | |
download | ice-aa6809bd9431b5cc3952d6a6e2abde76b2bf003c.tar.bz2 ice-aa6809bd9431b5cc3952d6a6e2abde76b2bf003c.tar.xz ice-aa6809bd9431b5cc3952d6a6e2abde76b2bf003c.zip |
Fixed bug 4511 - properties override doesn't handle quotes
Diffstat (limited to 'cpp/src/IceGrid/NodeI.cpp')
-rw-r--r-- | cpp/src/IceGrid/NodeI.cpp | 66 |
1 files changed, 17 insertions, 49 deletions
diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp index 7e5659771b1..90066875029 100644 --- a/cpp/src/IceGrid/NodeI.cpp +++ b/cpp/src/IceGrid/NodeI.cpp @@ -366,60 +366,28 @@ NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter, string overrides = props->getProperty("IceGrid.Node.PropertiesOverride"); if(!overrides.empty()) { - string::size_type end = 0; - while(end != string::npos) + const string delim = " \t\r\n"; + vector<string> overrideProps; + if(!IceUtilInternal::splitString(overrides, delim, overrideProps)) { - const string delim = " \t\r\n"; - - string::size_type beg = overrides.find_first_not_of(delim, end); - if(beg == string::npos) - { - break; - } - - end = overrides.find_first_of(delim, beg); - string arg; - if(end == string::npos) - { - arg = overrides.substr(beg); - } - else - { - arg = overrides.substr(beg, end - beg); - } + Ice::Warning out(_traceLevels->logger); + out << "invalid value for property `IceGrid.Node.PropertiesOverride':\nunmatched quote"; + } - if(arg.find("--") == 0) + for(vector<string>::iterator p = overrideProps.begin(); p != overrideProps.end(); ++p) + { + if(p->find("--") != 0) { - arg = arg.substr(2); + *p = "--" + *p; } + } - // - // Extract the key/value - // - string::size_type argEnd = arg.find_first_of(delim + "="); - if(argEnd == string::npos) - { - continue; - } - - string key = arg.substr(0, argEnd); - - argEnd = arg.find('=', argEnd); - if(argEnd == string::npos) - { - return; - } - ++argEnd; - - string value; - string::size_type argBeg = arg.find_first_not_of(delim, argEnd); - if(argBeg != string::npos) - { - argEnd = arg.length(); - value = arg.substr(argBeg, argEnd - argBeg); - } - - _propertiesOverride.push_back(createProperty(key, value)); + Ice::PropertiesPtr p = Ice::createProperties(); + p->parseCommandLineOptions("", overrideProps); + Ice::PropertyDict propDict = p->getPropertiesForPrefix(""); + for(Ice::PropertyDict::const_iterator q = propDict.begin(); q != propDict.end(); ++q) + { + _propertiesOverride.push_back(createProperty(q->first, q->second)); } } } |