Re: svn commit: r607188 - /xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/fo/FOTreeBuilder.java
Hi, Max Berger wrote: > Jeremias, > > not that fop is on 1.4: AFAIK this is what assert statements are for: > Add checks for things which *should not happen*, such as contract > violations. Yeah, I would probably add an assert statement, and if asserts are not enabled a NPE will be thrown anyway. But like for IllegalStateException that will probably also cause any prior exception to be swallowed by Xalan? So I guess the current situation is ok. Vincent -- Vincent HennebertAnyware Technologies http://people.apache.org/~vhennebert http://www.anyware-tech.com Apache FOP Committer FOP Development/Consulting
Re: svn commit: r607188 - /xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/fo/FOTreeBuilder.java
Jeremias, not that fop is on 1.4: AFAIK this is what assert statements are for: Add checks for things which *should not happen*, such as contract violations. Max On Mon, 2008-01-07 at 09:21 +0100, Jeremias Maerki wrote: > It could be null if the caller violates the ContentHandler contract. The > question should be: Should we validate the ContentHandler contract with > check code of our own? But that's an academic question because the check > is barely noticeable at runtime. > > On 02.01.2008 12:18:18 Vincent Hennebert wrote: > > Hi, > > > > > URL: http://svn.apache.org/viewvc?rev=607188&view=rev > > > Log: > > > Throwing IllegalStateException causes a prior exception to be swallowed > > > by Xalan-J. Need to throw a SAXException instead. > > > Instead of logging an error about the element mismatch throw a > > > SAXException because the logging only confuses the user as it's > > > practically always a follow-up exception of an exception happening > > > earlier in the respective startElement() event. > > > Modified: > > > xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/fo/FOTreeBuilder.java > > > > > +/** [EMAIL PROTECTED] */ > > > public void endElement(String uri, String localName, String > > > rawName) > > > throws SAXException { > > > if (currentFObj == null) { > > > > How can currentFObj be null in the first place? Normally it was set in > > the previous startElement event (or a ValidationException has been throw > > anyway)? > > > > Vincent > > > > > > -- > > Vincent HennebertAnyware Technologies > > http://people.apache.org/~vhennebert http://www.anyware-tech.com > > Apache FOP Committer FOP Development/Consulting > > > > > Jeremias Maerki >
Re: svn commit: r607188 - /xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/fo/FOTreeBuilder.java
It could be null if the caller violates the ContentHandler contract. The question should be: Should we validate the ContentHandler contract with check code of our own? But that's an academic question because the check is barely noticeable at runtime. On 02.01.2008 12:18:18 Vincent Hennebert wrote: > Hi, > > > URL: http://svn.apache.org/viewvc?rev=607188&view=rev > > Log: > > Throwing IllegalStateException causes a prior exception to be swallowed by > > Xalan-J. Need to throw a SAXException instead. > > Instead of logging an error about the element mismatch throw a SAXException > > because the logging only confuses the user as it's practically always a > > follow-up exception of an exception happening earlier in the respective > > startElement() event. > > Modified: > > xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/fo/FOTreeBuilder.java > > > +/** [EMAIL PROTECTED] */ > > public void endElement(String uri, String localName, String > > rawName) > > throws SAXException { > > if (currentFObj == null) { > > How can currentFObj be null in the first place? Normally it was set in > the previous startElement event (or a ValidationException has been throw > anyway)? > > Vincent > > > -- > Vincent HennebertAnyware Technologies > http://people.apache.org/~vhennebert http://www.anyware-tech.com > Apache FOP Committer FOP Development/Consulting Jeremias Maerki
Re: svn commit: r607188 - /xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/fo/FOTreeBuilder.java
Hi, > URL: http://svn.apache.org/viewvc?rev=607188&view=rev > Log: > Throwing IllegalStateException causes a prior exception to be swallowed by > Xalan-J. Need to throw a SAXException instead. > Instead of logging an error about the element mismatch throw a SAXException > because the logging only confuses the user as it's practically always a > follow-up exception of an exception happening earlier in the respective > startElement() event. > Modified: > xmlgraphics/fop/branches/Temp_ImagePackageRedesign/src/java/org/apache/fop/fo/FOTreeBuilder.java > +/** [EMAIL PROTECTED] */ > public void endElement(String uri, String localName, String rawName) > throws SAXException { > if (currentFObj == null) { How can currentFObj be null in the first place? Normally it was set in the previous startElement event (or a ValidationException has been throw anyway)? Vincent -- Vincent HennebertAnyware Technologies http://people.apache.org/~vhennebert http://www.anyware-tech.com Apache FOP Committer FOP Development/Consulting