version 1.76, 2009/12/15 11:39:33
|
version 1.76.6.1, 2011/08/08 08:42:55
|
|
|
{ | { |
if ((host != String::EMPTY) && !CIMObjectPathRep::isValidHostname(host)) | if ((host != String::EMPTY) && !CIMObjectPathRep::isValidHostname(host)) |
{ | { |
throw MalformedObjectNameException(host); |
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.INVALID_HOSTNAME", |
|
"$0, reason:\"invalid hostname\"", |
|
host); |
|
|
|
throw MalformedObjectNameException(mlParms); |
} | } |
| |
_rep = _copyOnWriteCIMObjectPathRep(_rep); | _rep = _copyOnWriteCIMObjectPathRep(_rep); |
|
|
char* slash = strchr(p, '/'); | char* slash = strchr(p, '/'); |
if (!slash) | if (!slash) |
{ | { |
throw MalformedObjectNameException(objectName); |
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.MISSING_SLASH_AFTER_HOST", |
|
"$0, reason:\"missing slash after hostname\"", |
|
objectName); |
|
throw MalformedObjectNameException(mlParms); |
} | } |
| |
String hostname = String(p, (Uint32)(slash - p)); | String hostname = String(p, (Uint32)(slash - p)); |
if (!CIMObjectPathRep::isValidHostname(hostname)) | if (!CIMObjectPathRep::isValidHostname(hostname)) |
{ | { |
throw MalformedObjectNameException(objectName); |
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.INVALID_HOSTNAME", |
|
"$0, reason:\"invalid hostname\"", |
|
objectName); |
|
throw MalformedObjectNameException(mlParms); |
} | } |
host = hostname; | host = hostname; |
| |
|
|
String namespaceName = String(p, (Uint32)(colon - p)); | String namespaceName = String(p, (Uint32)(colon - p)); |
if (!CIMNamespaceName::legal(namespaceName)) | if (!CIMNamespaceName::legal(namespaceName)) |
{ | { |
throw MalformedObjectNameException(objectName); |
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.INVALID_NAMESPACE", |
|
"$0, reason:\"invalid namespace name\"", |
|
objectName); |
|
throw MalformedObjectNameException(mlParms); |
} | } |
nameSpace = namespaceName; | nameSpace = namespaceName; |
| |
|
|
char* equalsign = strchr(p, '='); | char* equalsign = strchr(p, '='); |
if (!equalsign) | if (!equalsign) |
{ | { |
throw MalformedObjectNameException(objectName); |
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.INVALID_KEYVALUEPAIR", |
|
"$0, reason:\"invalid key-value pair, missing equal sign\"", |
|
objectName); |
|
throw MalformedObjectNameException(mlParms); |
} | } |
| |
*equalsign = 0; | *equalsign = 0; |
| |
if (!CIMName::legal(p)) | if (!CIMName::legal(p)) |
throw MalformedObjectNameException(objectName); |
{ |
|
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.INVALID_KEYNAME", |
|
"$0, reason:\"invalid key-value pair, invalid key name:$1\"", |
|
objectName, |
|
p); |
|
throw MalformedObjectNameException(mlParms); |
|
} |
| |
CIMName keyName (p); | CIMName keyName (p); |
| |
|
|
| |
if ((*p != '\\') && (*p != '"')) | if ((*p != '\\') && (*p != '"')) |
{ | { |
throw MalformedObjectNameException(objectName); |
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.INVALID_KEYVALUE", |
|
"$0, reason:\"invalid key-value pair, " |
|
"malformed value\"", |
|
objectName); |
|
throw MalformedObjectNameException(mlParms); |
} | } |
} | } |
| |
|
|
} | } |
| |
if (*p++ != '"') | if (*p++ != '"') |
throw MalformedObjectNameException(objectName); |
{ |
|
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.INVALID_KEYVALUEPAIR_MISSINGQUOTE", |
|
"$0, reason:\"invalid key-value pair, " |
|
"missing quote in key value\"", |
|
objectName); |
|
throw MalformedObjectNameException(mlParms); |
|
} |
| |
// Convert the UTF-8 value to a UTF-16 String | // Convert the UTF-8 value to a UTF-16 String |
| |
|
|
| |
if (!(((strncmp(p, "TRUE", n) == 0) && n == 4) || | if (!(((strncmp(p, "TRUE", n) == 0) && n == 4) || |
((strncmp(p, "FALSE", n) == 0) && n == 5))) | ((strncmp(p, "FALSE", n) == 0) && n == 5))) |
throw MalformedObjectNameException(objectName); |
{ |
|
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.INVALID_BOOLVALUE", |
|
"$0, reason:\"invalid key-value pair, " |
|
"value should be TRUE or FALSE\"", |
|
objectName); |
|
throw MalformedObjectNameException(mlParms); |
|
} |
| |
valueString.assign(p, n); | valueString.assign(p, n); |
| |
|
|
{ | { |
Sint64 x; | Sint64 x; |
if (!StringConversion::stringToSignedInteger(p, x)) | if (!StringConversion::stringToSignedInteger(p, x)) |
throw MalformedObjectNameException(objectName); |
{ |
|
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.INVALID_NEGATIVNUMBER_VALUE", |
|
"$0, reason:\"invalid key-value pair, " |
|
"invalid negative number value $1\"", |
|
objectName, |
|
p); |
|
throw MalformedObjectNameException(mlParms); |
|
} |
} | } |
else | else |
{ | { |
Uint64 x; | Uint64 x; |
if (!StringConversion::stringToUnsignedInteger(p, x)) | if (!StringConversion::stringToUnsignedInteger(p, x)) |
throw MalformedObjectNameException(objectName); |
{ |
|
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.INVALID_NEGATIVNUMBER_VALUE", |
|
"$0, reason:\"invalid key-value pair, " |
|
"invalid number value $1\"", |
|
objectName, |
|
p); |
|
throw MalformedObjectNameException(mlParms); |
|
} |
} | } |
| |
valueString.assign(p, n); | valueString.assign(p, n); |
|
|
{ | { |
if (*p++ != ',') | if (*p++ != ',') |
{ | { |
throw MalformedObjectNameException(objectName); |
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.INVALID_KEYVALUEPAIR_MISSCOMMA", |
|
"$0, reason:\"invalid key-value pair, " |
|
"next key-value pair has to start with comma\"", |
|
objectName); |
|
throw MalformedObjectNameException(mlParms); |
} | } |
} | } |
} | } |
|
|
| |
if (gotHost && !gotNamespace) | if (gotHost && !gotNamespace) |
{ | { |
throw MalformedObjectNameException(objectName); |
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.MISSING_NAMESPACE", |
|
"$0, reason:\"host specified, missing namespace\"", |
|
objectName); |
|
throw MalformedObjectNameException(mlParms); |
} | } |
| |
// Extract the class name: | // Extract the class name: |
|
|
{ | { |
if (!CIMName::legal(p)) | if (!CIMName::legal(p)) |
{ | { |
throw MalformedObjectNameException(objectName); |
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.INVALID_CLASSNAME", |
|
"$0, reason:\"class name $1 not a legal CIM name\"", |
|
objectName, |
|
p); |
|
throw MalformedObjectNameException(mlParms); |
} | } |
| |
// ATTN: remove this later: a reference should only be able to hold | // ATTN: remove this later: a reference should only be able to hold |
|
|
String className = String(p, (Uint32)(dot - p)); | String className = String(p, (Uint32)(dot - p)); |
if (!CIMName::legal(className)) | if (!CIMName::legal(className)) |
{ | { |
throw MalformedObjectNameException(objectName); |
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.INVALID_CLASSNAME", |
|
"$0, reason:\"class name $1 not a legal CIM name\"", |
|
objectName, |
|
className); |
|
throw MalformedObjectNameException(mlParms); |
} | } |
_rep->_className = className; | _rep->_className = className; |
| |
|
|
(host != System::getHostName()) && | (host != System::getHostName()) && |
!CIMObjectPathRep::isValidHostname(host)) | !CIMObjectPathRep::isValidHostname(host)) |
{ | { |
throw MalformedObjectNameException(host); |
MessageLoaderParms mlParms( |
|
"Common.CIMObjectPath.INVALID_HOSTNAME", |
|
"$0, reason:\"invalid hostname\"", |
|
host); |
|
throw MalformedObjectNameException(mlParms); |
} | } |
_rep = _copyOnWriteCIMObjectPathRep(_rep); | _rep = _copyOnWriteCIMObjectPathRep(_rep); |
| |