Commit 3a1a8c04 authored by Adam Goins's avatar Adam Goins
Browse files

Added file name to XML error message. #Fixes 4653

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@7948 41f8697f-d340-4b68-9986-7bafba869bb8
parent 1fbc1cfb
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -3024,6 +3024,7 @@ void IsisAml::StartParser(const char *xmlfile) {
  }

  catch(const XERCES::XMLException &toCatch) {

    QString message = "Error during XML parser initialization" +
                     (QString)XERCES::XMLString::transcode(toCatch.getMessage());
    throw Isis::IException(Isis::IException::Programmer, message, _FILEINFO_);
@@ -3074,6 +3075,17 @@ void IsisAml::StartParser(const char *xmlfile) {
    XERCES::XMLPlatformUtils::Terminate();
    return;
  }
  // This Exception is thrown whenever an error is encountered while parsing an XML file.
  // Stacked error messages are generated containing the file path and additional data about where the error occurred.
  catch (Isis::IException &e) {
      QString filePath = (QString) xmlfile;
      QString previousErrorMessage = (QString) e.toString();
      QString additionalErrorMessage = "Error while parsing application XML file [" + filePath + "]";

      throw Isis::IException(Isis::IException::Programmer, additionalErrorMessage + "\n" + previousErrorMessage, _FILEINFO_);
      XERCES::XMLPlatformUtils::Terminate();
      return;
  }

  //  Delete the parser
  delete parser;
+2 −0
Original line number Diff line number Diff line
@@ -148,6 +148,8 @@ class QString;
 *   @history 2016-08-28 Kelvin Rodriguez - Moved 'using namespace std' statements to be
 *                                         after #includes to squash implicit declaration
 *                                         warnings in clang. Part of porting to OSX 10.11.
 *   @history 2017-08-08 Adam Goins - Added an additional catch statement to display the 
 *                                    file name of an XML file that threw an error while parsing.
 */
class IsisAml : protected IsisAmlData {

+2 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ IsisXMLApplication::IsisXMLApplication(char *PencodingName,
                                       bool &PexpandNamespaces,
                                       XERCES::SAX2XMLReader* &Pparser,
                                       IsisAmlData *PappData) {

  encodingName = PencodingName;
  expandNamespaces = PexpandNamespaces;
  parser = Pparser;
@@ -53,6 +54,7 @@ IsisXMLApplication::IsisXMLApplication(char *PencodingName,
  multipleValuesHandler = NULL;
  ignoreHandler = NULL;
  historyHandler = NULL;

}

IsisXMLApplication::~IsisXMLApplication() {
+0 −1
Original line number Diff line number Diff line
@@ -155,7 +155,6 @@ void IsisXMLHandler::ignorableWhitespace(const XMLCh *const chars,
}



void IsisXMLHandler::processingInstruction(const XMLCh *const target,
    const XMLCh *const data) {
}