You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Claudia Baier <Cl...@gmx.de> on 2012/11/19 17:52:29 UTC

Crash in debug mode

Hello,

I have a problem running applications in debug mode. I try to process a xslt file which includes another xslt file. In release mode everything works fine. But in debug mode the application crashes with the message:

"Debug Assertion Failed!
...
Expression: invalid null pointer"

This happens when I call

theXalanTransformer.transform(*parsedXML, *xslIn, std::cout);

My environment:
- VS2010
- binary packages of Xerces 3.1.1 and Xalan 1.11.0

My code:

 //! namespace clarifications
  XALAN_USING_XALAN(XSLException);
  XALAN_USING_XALAN(XalanTransformer);
  XALAN_USING_XALAN(XalanDOMString);
  XALAN_USING_XALAN(XSLTInputSource);
  XALAN_USING_XALAN(XSLTResultTarget);
  XALAN_USING_XALAN(XalanParsedSource);
  XALAN_USING_XERCES(XMLPlatformUtils);
 
  try{
    XMLPlatformUtils::Initialize();
    XalanTransformer::initialize();
  } catch(const XSLException& xslException) {
    XalanTransformer::terminate();
    XMLPlatformUtils::Terminate();
    std::cout << ((xslException.getMessage()).c_str());
  }

    XalanTransformer theXalanTransformer;  
    const char* reportFilename = "C:\\tmp\\reportTest\\input.xml";
   
    //! transform XML->HTML
    const XalanParsedSource* parsedXML = 0;
    const XSLTInputSource* xmlIn =
      new XSLTInputSource(reportFilename);
    try{
      int result = theXalanTransformer.parseSource(*xmlIn,parsedXML);
      if (result !=0) {
        std::cout << "Error occured! " << theXalanTransformer.getLastError() << std::endl;
      }
    } catch (const XSLException& xslException) {
      delete xmlIn;
      xmlIn = 0;
      std::cout << "Error occured! " << theXalanTransformer.getLastError() << std::endl;
    }

    const char* xsltFileWithPath ="C:\\tmp\\reportTest\\foo2.xsl";
    XSLTInputSource* xslIn = new XSLTInputSource(xsltFileWithPath);
 
    //! first page containing basic report
    try {
      int result = theXalanTransformer.transform(*parsedXML, *xslIn, std::cout);
      if (result != 0) {
        delete xslIn;       
        xslIn  = 0;
       std::cout << "Error occured! " << theXalanTransformer.getLastError() << std::endl;
      }
    } catch (const XSLException &xslException) {
      delete xslIn;
      xslIn  = 0;
      std::cout << "Error occured! " << theXalanTransformer.getLastError() << std::endl;
    }
    delete xslIn;
    xslIn  = 0;
    delete xmlIn;
    xmlIn = 0;


Is this a known issue? How can I avoid this assertion failure?

Thanks for your help.

Kind regards 
Claudia

Re: Crash in debug mode

Posted by Claudia Baier <Cl...@gmx.de>.
Hello Steven,

thank you for your answer.

The assertion failure appears in the file xutility. This is shipped with Visual Studio. The xutility file is responsible for some checks about the correct initialization of arrays and iterators. Therefore I suppose that it is a problem of initialization of objects for the included XSLT file. In the xutility the checks which are made depend on the value of the _ITERATOR_DEBUG_LEVEL macro. The default for this macro differs between release and debug mode. For me this could be an explication for the different behaviour in release and debug mode.

Furthermore I can say that the included XSLT file definitely exists. The code where the assertion failure occurs ran in the past with Xerces 2.7.0 and Xalan 1.10 compiled with Visual Studio 2005. I never had this problem. Due to the migration of the project to Visual Studio 2010 I did also the update of Xerces and Xalan. 

I will also create an issue in the bugtracking system you mentioned. There I will attach a complete project containing test files to reproduce the problem.

Kind regards
Claudia



-------- Original-Nachricht --------
> Datum: Mon, 19 Nov 2012 15:13:10 -0800 (PST)
> Von: shathawa@e-z.net
> An: c-users@xalan.apache.org
> CC: ClaudiaBa@gmx.de
> Betreff: Re: Crash in debug mode

> Claudia,
> 
> It could also be that your included XSLT file did not exist or was empty
> for some reason.  I have tried to allow these conditions without <assert>
> faults by making sure that empty readers were supported.
> 
> Sincerely,
> Steven J. Hathaway
> Xalan Documentation Project
> 
> > Hello,
> >
> > I have a problem running applications in debug mode. I try to process a
> > xslt file which includes another xslt file. In release mode everything
> > works fine. But in debug mode the application crashes with the message:
> >
> > "Debug Assertion Failed!
> > ...
> > Expression: invalid null pointer"
> >
> > This happens when I call
> >
> > theXalanTransformer.transform(*parsedXML, *xslIn, std::cout);
> >
> > My environment:
> > - VS2010
> > - binary packages of Xerces 3.1.1 and Xalan 1.11.0
> >
> > My code:
> >
> >  //! namespace clarifications
> >   XALAN_USING_XALAN(XSLException);
> >   XALAN_USING_XALAN(XalanTransformer);
> >   XALAN_USING_XALAN(XalanDOMString);
> >   XALAN_USING_XALAN(XSLTInputSource);
> >   XALAN_USING_XALAN(XSLTResultTarget);
> >   XALAN_USING_XALAN(XalanParsedSource);
> >   XALAN_USING_XERCES(XMLPlatformUtils);
> >
> >   try{
> >     XMLPlatformUtils::Initialize();
> >     XalanTransformer::initialize();
> >   } catch(const XSLException& xslException) {
> >     XalanTransformer::terminate();
> >     XMLPlatformUtils::Terminate();
> >     std::cout << ((xslException.getMessage()).c_str());
> >   }
> >
> >     XalanTransformer theXalanTransformer;
> >     const char* reportFilename = "C:\\tmp\\reportTest\\input.xml";
> >
> >     //! transform XML->HTML
> >     const XalanParsedSource* parsedXML = 0;
> >     const XSLTInputSource* xmlIn =
> >       new XSLTInputSource(reportFilename);
> >     try{
> >       int result = theXalanTransformer.parseSource(*xmlIn,parsedXML);
> >       if (result !=0) {
> >         std::cout << "Error occured! " <<
> > theXalanTransformer.getLastError() << std::endl;
> >       }
> >     } catch (const XSLException& xslException) {
> >       delete xmlIn;
> >       xmlIn = 0;
> >       std::cout << "Error occured! " <<
> theXalanTransformer.getLastError()
> > << std::endl;
> >     }
> >
> >     const char* xsltFileWithPath ="C:\\tmp\\reportTest\\foo2.xsl";
> >     XSLTInputSource* xslIn = new XSLTInputSource(xsltFileWithPath);
> >
> >     //! first page containing basic report
> >     try {
> >       int result = theXalanTransformer.transform(*parsedXML, *xslIn,
> > std::cout);
> >       if (result != 0) {
> >         delete xslIn;
> >         xslIn  = 0;
> >        std::cout << "Error occured! " <<
> > theXalanTransformer.getLastError() << std::endl;
> >       }
> >     } catch (const XSLException &xslException) {
> >       delete xslIn;
> >       xslIn  = 0;
> >       std::cout << "Error occured! " <<
> theXalanTransformer.getLastError()
> > << std::endl;
> >     }
> >     delete xslIn;
> >     xslIn  = 0;
> >     delete xmlIn;
> >     xmlIn = 0;
> >
> >
> > Is this a known issue? How can I avoid this assertion failure?
> >
> > Thanks for your help.
> >
> > Kind regards
> > Claudia
> >
> >
> 
> 

Re: Crash in debug mode

Posted by sh...@e-z.net.
Claudia,

It could also be that your included XSLT file did not exist or was empty
for some reason.  I have tried to allow these conditions without <assert>
faults by making sure that empty readers were supported.

Sincerely,
Steven J. Hathaway
Xalan Documentation Project

> Hello,
>
> I have a problem running applications in debug mode. I try to process a
> xslt file which includes another xslt file. In release mode everything
> works fine. But in debug mode the application crashes with the message:
>
> "Debug Assertion Failed!
> ...
> Expression: invalid null pointer"
>
> This happens when I call
>
> theXalanTransformer.transform(*parsedXML, *xslIn, std::cout);
>
> My environment:
> - VS2010
> - binary packages of Xerces 3.1.1 and Xalan 1.11.0
>
> My code:
>
>  //! namespace clarifications
>   XALAN_USING_XALAN(XSLException);
>   XALAN_USING_XALAN(XalanTransformer);
>   XALAN_USING_XALAN(XalanDOMString);
>   XALAN_USING_XALAN(XSLTInputSource);
>   XALAN_USING_XALAN(XSLTResultTarget);
>   XALAN_USING_XALAN(XalanParsedSource);
>   XALAN_USING_XERCES(XMLPlatformUtils);
>
>   try{
>     XMLPlatformUtils::Initialize();
>     XalanTransformer::initialize();
>   } catch(const XSLException& xslException) {
>     XalanTransformer::terminate();
>     XMLPlatformUtils::Terminate();
>     std::cout << ((xslException.getMessage()).c_str());
>   }
>
>     XalanTransformer theXalanTransformer;
>     const char* reportFilename = "C:\\tmp\\reportTest\\input.xml";
>
>     //! transform XML->HTML
>     const XalanParsedSource* parsedXML = 0;
>     const XSLTInputSource* xmlIn =
>       new XSLTInputSource(reportFilename);
>     try{
>       int result = theXalanTransformer.parseSource(*xmlIn,parsedXML);
>       if (result !=0) {
>         std::cout << "Error occured! " <<
> theXalanTransformer.getLastError() << std::endl;
>       }
>     } catch (const XSLException& xslException) {
>       delete xmlIn;
>       xmlIn = 0;
>       std::cout << "Error occured! " << theXalanTransformer.getLastError()
> << std::endl;
>     }
>
>     const char* xsltFileWithPath ="C:\\tmp\\reportTest\\foo2.xsl";
>     XSLTInputSource* xslIn = new XSLTInputSource(xsltFileWithPath);
>
>     //! first page containing basic report
>     try {
>       int result = theXalanTransformer.transform(*parsedXML, *xslIn,
> std::cout);
>       if (result != 0) {
>         delete xslIn;
>         xslIn  = 0;
>        std::cout << "Error occured! " <<
> theXalanTransformer.getLastError() << std::endl;
>       }
>     } catch (const XSLException &xslException) {
>       delete xslIn;
>       xslIn  = 0;
>       std::cout << "Error occured! " << theXalanTransformer.getLastError()
> << std::endl;
>     }
>     delete xslIn;
>     xslIn  = 0;
>     delete xmlIn;
>     xmlIn = 0;
>
>
> Is this a known issue? How can I avoid this assertion failure?
>
> Thanks for your help.
>
> Kind regards
> Claudia
>
>



Re: Crash in debug mode

Posted by sh...@e-z.net.
Claudia,

Can you identify which lower method has the <assert> trap?

I have been trying to find all the NULL pointer traps and
verify their correctness, hopefully fixing the code to allow
NULL. Many have been fixed.

I may have missed something here -- easy to overlook.

You can also post a bug on JIRA - XALANC for tracking.
Details and files can also be attached to JIRA issues.

Sincerely,
Steven J. Hathaway
Xalan Documentation Project

> Hello,
>
> I have a problem running applications in debug mode. I try to process a
> xslt file which includes another xslt file. In release mode everything
> works fine. But in debug mode the application crashes with the message:
>
> "Debug Assertion Failed!
> ...
> Expression: invalid null pointer"
>
> This happens when I call
>
> theXalanTransformer.transform(*parsedXML, *xslIn, std::cout);
>
> My environment:
> - VS2010
> - binary packages of Xerces 3.1.1 and Xalan 1.11.0
>
> My code:
>
>  //! namespace clarifications
>   XALAN_USING_XALAN(XSLException);
>   XALAN_USING_XALAN(XalanTransformer);
>   XALAN_USING_XALAN(XalanDOMString);
>   XALAN_USING_XALAN(XSLTInputSource);
>   XALAN_USING_XALAN(XSLTResultTarget);
>   XALAN_USING_XALAN(XalanParsedSource);
>   XALAN_USING_XERCES(XMLPlatformUtils);
>
>   try{
>     XMLPlatformUtils::Initialize();
>     XalanTransformer::initialize();
>   } catch(const XSLException& xslException) {
>     XalanTransformer::terminate();
>     XMLPlatformUtils::Terminate();
>     std::cout << ((xslException.getMessage()).c_str());
>   }
>
>     XalanTransformer theXalanTransformer;
>     const char* reportFilename = "C:\\tmp\\reportTest\\input.xml";
>
>     //! transform XML->HTML
>     const XalanParsedSource* parsedXML = 0;
>     const XSLTInputSource* xmlIn =
>       new XSLTInputSource(reportFilename);
>     try{
>       int result = theXalanTransformer.parseSource(*xmlIn,parsedXML);
>       if (result !=0) {
>         std::cout << "Error occured! " <<
> theXalanTransformer.getLastError() << std::endl;
>       }
>     } catch (const XSLException& xslException) {
>       delete xmlIn;
>       xmlIn = 0;
>       std::cout << "Error occured! " << theXalanTransformer.getLastError()
> << std::endl;
>     }
>
>     const char* xsltFileWithPath ="C:\\tmp\\reportTest\\foo2.xsl";
>     XSLTInputSource* xslIn = new XSLTInputSource(xsltFileWithPath);
>
>     //! first page containing basic report
>     try {
>       int result = theXalanTransformer.transform(*parsedXML, *xslIn,
> std::cout);
>       if (result != 0) {
>         delete xslIn;
>         xslIn  = 0;
>        std::cout << "Error occured! " <<
> theXalanTransformer.getLastError() << std::endl;
>       }
>     } catch (const XSLException &xslException) {
>       delete xslIn;
>       xslIn  = 0;
>       std::cout << "Error occured! " << theXalanTransformer.getLastError()
> << std::endl;
>     }
>     delete xslIn;
>     xslIn  = 0;
>     delete xmlIn;
>     xmlIn = 0;
>
>
> Is this a known issue? How can I avoid this assertion failure?
>
> Thanks for your help.
>
> Kind regards
> Claudia
>
>