You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "David B. Bitton" <da...@codenoevil.com> on 2002/04/23 15:34:04 UTC

Exception message text not bubbling up

My current implementation passes the Driver into the Sax transform.  If the
transform creates malformed xsl:fo, which is a possibility, the FOPException
that is raised by FOP, is coming up to the top as an NPE and not the actuall
message text.

For example, line 149 of org.apache.fop.pagination.PageSequence:

            throw new FOPException("page-sequence must be child of root, not
"
                                   + parent.getName());

is eventually thrown by the Transformer as a TransformerException, but when
I getMessage(), it's an NPE.  Any idea why this would be?

--

David B. Bitton
david@codenoevil.com
www.codenoevil.com

Code Made Fresh DailyT


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Exception message text not bubbling up

Posted by "David B. Bitton" <da...@codenoevil.com>.
No, I know what stack traces info is.  You asked me if I was sure whether
FOP threw the exception, and yes, based on the stack trace, it was FOP that
threw the exception.
--

David B. Bitton
david@codenoevil.com
www.codenoevil.com

Code Made Fresh DailyT
----- Original Message -----
From: "J.Pietschmann" <j3...@yahoo.de>
To: <fo...@xml.apache.org>
Sent: Wednesday, April 24, 2002 4:22 PM
Subject: Re: Exception message text not bubbling up


> David B. Bitton wrote:
> > It;s just that the stack trace shows the exception being thrown from
line
> > 149 of ...PageSequence.  Oh well.
>
> Stack traces of exceptions mention Java source file names
> and line numbers where they are thrown.
> Actually, what do you expect? Name+line of the FO source
> where the error happens? That's not all that hard, however,
> what should be used if you are generating the FO on the
> fly using XSLT?
>
> J.Pietschmann
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Exception message text not bubbling up

Posted by "J.Pietschmann" <j3...@yahoo.de>.
David B. Bitton wrote:
> It;s just that the stack trace shows the exception being thrown from line
> 149 of ...PageSequence.  Oh well.

Stack traces of exceptions mention Java source file names
and line numbers where they are thrown.
Actually, what do you expect? Name+line of the FO source
where the error happens? That's not all that hard, however,
what should be used if you are generating the FO on the
fly using XSLT?

J.Pietschmann



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Exception message text not bubbling up

Posted by "David B. Bitton" <da...@codenoevil.com>.
Would that cause the entire exception message to be null though?    This all
stemmed from a change I had made to the underlying XML which caused the XSLT
not to match the root element, and therefore not outputing a <fo:root> in
the resultant transformation, so to answer your question, yes the parent was
null.



--

David B. Bitton
david@codenoevil.com
www.codenoevil.com

Code Made Fresh DailyT
----- Original Message -----
From: "Nancy Deschenes" <na...@spiders.com>
To: "David B. Bitton" <da...@codenoevil.com>
Sent: Wednesday, April 24, 2002 4:57 PM
Subject: Re: Exception message text not bubbling up


> On Wed, 24-Apr-2002 at 00:35, "David B. Bitton" <da...@codenoevil.com>
wrote:
>
>  +---
>  | It;s just that the stack trace shows the exception being thrown from
line
>  | 149 of ...PageSequence.  Oh well.
>  |
>  | [...]
>  |
>  | > > For example, line 149 of org.apache.fop.pagination.PageSequence:
>  | > >
>  | > >             throw new FOPException("page-sequence must be child of
root,
>  | not
>  | > > "
>  | > >                                    + parent.getName());
>  | > >
>  | > > is eventually thrown by the Transformer as a TransformerException,
but
>  | when
>  | > > I getMessage(), it's an NPE.  Any idea why this would be?
>  +---
>
> Is it at all possible that parent is null?
>
> Nancy Deschenes
> Objective Consulting, Inc.
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Exception message text not bubbling up

Posted by "David B. Bitton" <da...@codenoevil.com>.
It;s just that the stack trace shows the exception being thrown from line
149 of ...PageSequence.  Oh well.
--

David B. Bitton
david@codenoevil.com
www.codenoevil.com

Code Made Fresh DailyT
----- Original Message -----
From: "J.Pietschmann" <j3...@yahoo.de>
To: <fo...@xml.apache.org>
Sent: Tuesday, April 23, 2002 3:17 PM
Subject: Re: Exception message text not bubbling up


> David B. Bitton wrote:
> > My current implementation passes the Driver into the Sax transform.  If
the
> > transform creates malformed xsl:fo, which is a possibility, the
FOPException
> > that is raised by FOP, is coming up to the top as an NPE and not the
actuall
> > message text.
> >
> > For example, line 149 of org.apache.fop.pagination.PageSequence:
> >
> >             throw new FOPException("page-sequence must be child of root,
not
> > "
> >                                    + parent.getName());
> >
> > is eventually thrown by the Transformer as a TransformerException, but
when
> > I getMessage(), it's an NPE.  Any idea why this would be?
> >
> Are you sure you don't have something else which causes the parser
> or the transformer to throw a NPE?
>
> With the following code
>   try {
>     Driver driver=new Driver();
>     driver.setRenderer(Driver.RENDERER_PDF);
>     driver.setOutputStream(...);
>     Transformer transformer=TransformerFactory.newInstance()
>       .newTransformer(new StreamSource(new File("stuff.xsl")));
>     transformer.transform(new StreamSource(new File("stuff.xml")),
>      new SAXSource(driver.getContentHandler()));
>   }
>   catch( Exception e) {
>     System.out.println(e.getMessage());
>   }
> I get the "page-sequence must be..." message without a problem, and
> the caught Exception is a TransformerException.
>
>
> J.Pietschmann
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Exception message text not bubbling up

Posted by "J.Pietschmann" <j3...@yahoo.de>.
David B. Bitton wrote:
> My current implementation passes the Driver into the Sax transform.  If the
> transform creates malformed xsl:fo, which is a possibility, the FOPException
> that is raised by FOP, is coming up to the top as an NPE and not the actuall
> message text.
> 
> For example, line 149 of org.apache.fop.pagination.PageSequence:
> 
>             throw new FOPException("page-sequence must be child of root, not
> "
>                                    + parent.getName());
> 
> is eventually thrown by the Transformer as a TransformerException, but when
> I getMessage(), it's an NPE.  Any idea why this would be?
> 
Are you sure you don't have something else which causes the parser
or the transformer to throw a NPE?

With the following code
  try {
    Driver driver=new Driver();
    driver.setRenderer(Driver.RENDERER_PDF);
    driver.setOutputStream(...);
    Transformer transformer=TransformerFactory.newInstance()
      .newTransformer(new StreamSource(new File("stuff.xsl")));
    transformer.transform(new StreamSource(new File("stuff.xml")),
     new SAXSource(driver.getContentHandler()));
  }
  catch( Exception e) {
    System.out.println(e.getMessage());
  }
I get the "page-sequence must be..." message without a problem, and
the caught Exception is a TransformerException.


J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org