Update of /cvsroot/opal/opal/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8859/src
Modified Files:
BlueprintManager.cpp BlueprintManager.h
Log Message:
Fixed XML loading bug which crashed on missing string attributes.
Index: BlueprintManager.cpp
===================================================================
RCS file: /cvsroot/opal/opal/src/BlueprintManager.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** BlueprintManager.cpp 19 Apr 2005 14:20:34 -0000 1.41
--- BlueprintManager.cpp 3 May 2005 15:55:53 -0000 1.42
***************
*** 80,84 ****
}
! // Find the root element (i.e. the 'OpalBlueprint" element).
TiXmlElement* rootElement = file.RootElement();
if (NULL == rootElement)
--- 80,84 ----
}
! // Find the root element (i.e. the 'OpalBlueprint' element).
TiXmlElement* rootElement = file.RootElement();
if (NULL == rootElement)
***************
*** 1598,1604 ****
{
OPAL_LOGGER("warning") <<
! "opal::BlueprintManager::getAttribute: Element "
! << nodePtr->Value() << " is missing attribute "
! << name << ". Parameter will be set to 0.0."
<< std::endl;
return 0;
--- 1598,1604 ----
{
OPAL_LOGGER("warning") <<
! "opal::BlueprintManager::getAttributeReal: Element "
! << nodePtr->Value() << " is missing attribute '"
! << name << "'. Parameter will be set to 0.0."
<< std::endl;
return 0;
***************
*** 1613,1618 ****
}
! std::string BlueprintManager::getAttributeString(const TiXmlNode*
! nodePtr, const std::string& name)const
{
#ifdef OPAL_USE_XML
--- 1613,1618 ----
}
! std::string BlueprintManager::getAttributeString(
! const TiXmlNode* nodePtr, const std::string& name)const
{
#ifdef OPAL_USE_XML
***************
*** 1620,1631 ****
TiXmlElement* elementPtr =
const_cast<TiXmlNode*>(nodePtr)->ToElement();
! std::string temp = elementPtr->Attribute(name.c_str());
! if ("" == temp)
{
OPAL_LOGGER("warning") <<
! "opal::BlueprintManager::getAttribute: Element "
! << nodePtr->Value() << " is missing attribute "
! << name << ". Parameter will be set to \"\"."
<< std::endl;
return "";
--- 1620,1631 ----
TiXmlElement* elementPtr =
const_cast<TiXmlNode*>(nodePtr)->ToElement();
! const char* temp = elementPtr->Attribute(name.c_str());
! if (NULL == temp)
{
OPAL_LOGGER("warning") <<
! "opal::BlueprintManager::getAttributeString: Element "
! << nodePtr->Value() << " is missing attribute '"
! << name << "'. Parameter will be set to \"\"."
<< std::endl;
return "";
Index: BlueprintManager.h
===================================================================
RCS file: /cvsroot/opal/opal/src/BlueprintManager.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** BlueprintManager.h 19 Apr 2005 14:20:35 -0000 1.21
--- BlueprintManager.h 3 May 2005 15:55:54 -0000 1.22
***************
*** 175,180 ****
const std::string& name)const;
! /// Helper function; returns false if the attribute doesn't
! /// exist.
std::string getAttributeString(const TiXmlNode* nodePtr,
const std::string& name)const;
--- 175,180 ----
const std::string& name)const;
! /// Helper function; returns an empty string if the attribute
! /// doesn't exist.
std::string getAttributeString(const TiXmlNode* nodePtr,
const std::string& name)const;
|