Commit 5b91d159937481fac15d3adf9d4796c52e029a9c

Authored by Benjamin Renard
1 parent db1508cd

Fix catalog readers when an attribute of a parameter is not defined

src/TimeTableCatalog/InternalXMLReader.cc
... ... @@ -154,15 +154,24 @@ void InternalXMLReader::processNode(TimeTable& pTT, xmlTextReaderPtr reader, int
154 154 attrUcd = xmlTextReaderGetAttribute (reader, (const xmlChar*)InternalXMLData::ATTRIB_UCD);
155 155 attrUtype = xmlTextReaderGetAttribute (reader, (const xmlChar*)InternalXMLData::ATTRIB_UTYPE);
156 156  
  157 + std::string attrIdStr = (attrId != NULL) ? std::string((const char *)attrId) : "";
  158 + std::string attrNameStr = (attrName != NULL) ? std::string((const char *)attrName) : "";
  159 + std::string attrSizeStr = (attrSize != NULL) ? std::string((const char *)attrSize) : "";
  160 + std::string attrTypeStr = (attrType != NULL) ? std::string((const char *)attrType) : "";
  161 + std::string attrUnitStr = (attrUnit != NULL) ? std::string((const char *)attrUnit) : "";
  162 + std::string attrDescriptionStr = (attrDescription != NULL) ? std::string((const char *)attrDescription) : "";
  163 + std::string attrUcdStr = (attrUcd != NULL) ? std::string((const char *)attrUcd) : "";
  164 + std::string attrUtypeStr = (attrUtype != NULL) ? std::string((const char *)attrUtype) : "";
  165 +
157 166 ((Catalog *) &pTT)->addParameterDescription(ParameterDescription(
158   - std::string((const char *)attrId),
159   - std::string((const char *)attrName),
160   - std::string((const char *)attrSize),
161   - std::string((const char *)attrType),
162   - std::string((const char *)attrUnit),
163   - std::string((const char *)attrDescription),
164   - std::string((const char *)attrUcd),
165   - std::string((const char *)attrUtype)));
  167 + attrIdStr,
  168 + attrNameStr,
  169 + attrSizeStr,
  170 + attrTypeStr,
  171 + attrUnitStr,
  172 + attrDescriptionStr,
  173 + attrUcdStr,
  174 + attrUtypeStr));
166 175  
167 176 // Jump to next XML_PARAMETER_TAG
168 177 _step = READ_STEP::NO_TAG;
... ...
src/TimeTableCatalog/VOTableReader.cc
... ... @@ -152,15 +152,21 @@ void VOTableReader::readField(TimeTable& pTT, xmlTextReaderPtr reader) {
152 152 internalSize = std::string((const char *)attrSize);
153 153 }
154 154  
  155 + std::string attrIdStr = (attrId != NULL) ? std::string((const char *)attrId) : "";
  156 + std::string attrNameStr = (attrName != NULL) ? std::string((const char *)attrName) : "";
  157 + std::string attrUnitStr = (attrUnit != NULL) ? std::string((const char *)attrUnit) : "";
  158 + std::string attrUcdStr = (attrUcd != NULL) ? std::string((const char *)attrUcd) : "";
  159 + std::string attrUtypeStr = (attrUtype != NULL) ? std::string((const char *)attrUtype) : "";
  160 +
155 161 ((Catalog *) &pTT)->addParameterDescription(ParameterDescription(
156   - std::string((const char *)attrId),
157   - std::string((const char *)attrName),
  162 + attrIdStr,
  163 + attrNameStr,
158 164 internalSize,
159 165 internalType,
160   - std::string((const char *)attrUnit),
  166 + attrUnitStr,
161 167 "", // Read later
162   - std::string((const char *)attrUcd),
163   - std::string((const char *)attrUtype)));
  168 + attrUcdStr,
  169 + attrUtypeStr));
164 170  
165 171 }
166 172 }
... ...