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 bu...@apache.org on 2009/12/11 21:38:02 UTC

DO NOT REPLY [Bug 48380] New: ClassCastException when using fox:widow-content-limit

https://issues.apache.org/bugzilla/show_bug.cgi?id=48380

           Summary: ClassCastException when using fox:widow-content-limit
           Product: Fop
           Version: 1.0dev
          Platform: PC
        OS/Version: Windows Vista
            Status: NEW
          Severity: normal
          Priority: P2
         Component: page-master/layout
        AssignedTo: fop-dev@xmlgraphics.apache.org
        ReportedBy: matthias8283@gmx.at


I created a table with the fox:widow-content-limit attribute. If a table cell
contains a list-block element, which has the space-after attribute, a
ClassCastException occurs.

A small testcase is attached.

Stacktrace:
11.12.2009 17:30:13 org.apache.fop.cli.Main startFOP
SCHWERWIEGEND: Exception
java.lang.ClassCastException: org.apache.fop.layoutmgr.SpaceElement
    at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:302)
    at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
    at org.apache.fop.cli.Main.startFOP(Main.java:174)
    at org.apache.fop.cli.Main.main(Main.java:205)
Caused by: java.lang.ClassCastException: org.apache.fop.layoutmgr.SpaceElement
    at
org.apache.fop.layoutmgr.ElementListUtils.removeLegalBreaks(ElementListUtils.java:87)
    at
org.apache.fop.layoutmgr.list.ListBlockLayoutManager.getNextKnuthElements(ListBlockLayoutManager.java:125)
    at
org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextChildElements(BlockStackingLayoutManager.java:571)
    at
org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextChildElements(BlockStackingLayoutManager.java:552)
    at
org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:280)
    at
org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:123)
    at
org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:115)
    at
org.apache.fop.layoutmgr.table.TableCellLayoutManager.getNextKnuthElements(TableCellLayoutManager.java:154)
    at
org.apache.fop.layoutmgr.table.RowGroupLayoutManager.createElementsForRowGroup(RowGroupLayoutManager.java:118)
    at
org.apache.fop.layoutmgr.table.RowGroupLayoutManager.getNextKnuthElements(RowGroupLayoutManager.java:61)
    at
org.apache.fop.layoutmgr.table.TableContentLayoutManager.getKnuthElementsForRowIterator(TableContentLayoutManager.java:220)
    at
org.apache.fop.layoutmgr.table.TableContentLayoutManager.getNextKnuthElements(TableContentLayoutManager.java:173)
    at
org.apache.fop.layoutmgr.table.TableLayoutManager.getNextKnuthElements(TableLayoutManager.java:249)
    at
org.apache.fop.layoutmgr.FlowLayoutManager.getNextChildElements(FlowLayoutManager.java:199)
    at
org.apache.fop.layoutmgr.FlowLayoutManager.addChildElements(FlowLayoutManager.java:140)
    at
org.apache.fop.layoutmgr.FlowLayoutManager.addChildElements(FlowLayoutManager.java:129)
    at
org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:70)
    at
org.apache.fop.layoutmgr.PageBreaker.getNextKnuthElements(PageBreaker.java:216)
    at
org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:697)
    at
org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:149)
    at
org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:132)
    at
org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:341)
    at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:85)
    at
org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:107)
    at
org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:238)
    at
org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:120)
    at
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:349)
    at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)
    at
org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1101)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
    at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
    at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
    at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
    at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:299)
    ... 3 more

---------

java.lang.ClassCastException: org.apache.fop.layoutmgr.SpaceElement
    at
org.apache.fop.layoutmgr.ElementListUtils.removeLegalBreaks(ElementListUtils.java:87)
    at
org.apache.fop.layoutmgr.list.ListBlockLayoutManager.getNextKnuthElements(ListBlockLayoutManager.java:125)
    at
org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextChildElements(BlockStackingLayoutManager.java:571)
    at
org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextChildElements(BlockStackingLayoutManager.java:552)
    at
org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:280)
    at
org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:123)
    at
org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:115)
    at
org.apache.fop.layoutmgr.table.TableCellLayoutManager.getNextKnuthElements(TableCellLayoutManager.java:154)
    at
org.apache.fop.layoutmgr.table.RowGroupLayoutManager.createElementsForRowGroup(RowGroupLayoutManager.java:118)
    at
org.apache.fop.layoutmgr.table.RowGroupLayoutManager.getNextKnuthElements(RowGroupLayoutManager.java:61)
    at
org.apache.fop.layoutmgr.table.TableContentLayoutManager.getKnuthElementsForRowIterator(TableContentLayoutManager.java:220)
    at
org.apache.fop.layoutmgr.table.TableContentLayoutManager.getNextKnuthElements(TableContentLayoutManager.java:173)
    at
org.apache.fop.layoutmgr.table.TableLayoutManager.getNextKnuthElements(TableLayoutManager.java:249)
    at
org.apache.fop.layoutmgr.FlowLayoutManager.getNextChildElements(FlowLayoutManager.java:199)
    at
org.apache.fop.layoutmgr.FlowLayoutManager.addChildElements(FlowLayoutManager.java:140)
    at
org.apache.fop.layoutmgr.FlowLayoutManager.addChildElements(FlowLayoutManager.java:129)
    at
org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:70)
    at
org.apache.fop.layoutmgr.PageBreaker.getNextKnuthElements(PageBreaker.java:216)
    at
org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:697)
    at
org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:149)
    at
org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:132)
    at
org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:341)
    at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:85)
    at
org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:107)
    at
org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:238)
    at
org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:120)
    at
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:349)
    at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)
    at
org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1101)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
    at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
    at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
    at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
    at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:299)
    at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
    at org.apache.fop.cli.Main.startFOP(Main.java:174)
    at org.apache.fop.cli.Main.main(Main.java:205)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48380] ClassCastException when using fox:widow-content-limit

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48380

Glenn Adams <gl...@skynav.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

--- Comment #4 from Glenn Adams <gl...@skynav.com> 2012-04-01 06:17:54 UTC ---
batch transition to closed; if someone wishes to restore one of these to
resolved in order to perform a verification step, then feel free to do so

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48380] ClassCastException when using fox:widow-content-limit

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48380

Andreas L. Delmelle <ad...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Andreas L. Delmelle <ad...@apache.org> 2011-01-07 16:18:15 EST ---

Fixed in Trunk. See: http://svn.apache.org/viewvc?rev=1056513&view=rev

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Re: DO NOT REPLY [Bug 48380] ClassCastException when using fox:widow-content-limit

Posted by Andreas Delmelle <an...@telenet.be>.
On 07 Jan 2011, at 17:03, Simon Pepping wrote:

> Your patch seems OK to me. Even though the conditionals handle some
> tricky navigation through the list, this is the best way to use the
> similarities between the two methods.
> 
> Will you apply it?

Sure, will do!

Regards

Andreas


Re: DO NOT REPLY [Bug 48380] ClassCastException when using fox:widow-content-limit

Posted by Simon Pepping <sp...@leverkruid.eu>.
Your patch seems OK to me. Even though the conditionals handle some
tricky navigation through the list, this is the best way to use the
similarities between the two methods.

Will you apply it?

Simon

On Wed, Jan 05, 2011 at 02:01:55PM -0500, bugzilla@apache.org wrote:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=48380
> 
> --- Comment #2 from Andreas L. Delmelle <ad...@apache.org> 2011-01-05 14:01:49 EST ---
> Created an attachment (id=26460)
>  --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26460)
> proposed patch to ElementListUtils.java
> 
> Apologies for the late response...
> 
> I noticed the issue did not occur with fox:orphan-content-limit, since that
> triggers a call to ElementListUtils.removeLegalBreaksFromEnd(), which was
> equipped to deal with SpaceElements, contrary to the method
> removeLegalBreaks(), where the exception was thrown. 
> Seems like the implementations of both methods were meant to be analogous, but
> got out of alignment.
> Proposal is to fix this by merging the implementations into one private method,
> as they were almost identical anyway (apart from 3-4 lines, which can be
> handled rather gracefully through conditionals).
> For now, the proposed fix does not alter the behavior in any way, except by
> avoiding the potential ClassCastException, although it did get me wondering
> whether the treatment of spaces is always correct here... 
> Think: consecutive/adjoining spaces with a different precedence value, and
> whether it is correct to just add the space's optimum width. Theoretically, it
> seems possible that we leave in a break-opportunity that turns out (= after
> space-resolution) to leave less content before the break than the constraint
> specifies, because we counted 2 spaces here, of which only one is retained in
> the eventual output (?)
> 
> -- 
> Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are the assignee for the bug.

DO NOT REPLY [Bug 48380] ClassCastException when using fox:widow-content-limit

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48380

--- Comment #2 from Andreas L. Delmelle <ad...@apache.org> 2011-01-05 14:01:49 EST ---
Created an attachment (id=26460)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26460)
proposed patch to ElementListUtils.java

Apologies for the late response...

I noticed the issue did not occur with fox:orphan-content-limit, since that
triggers a call to ElementListUtils.removeLegalBreaksFromEnd(), which was
equipped to deal with SpaceElements, contrary to the method
removeLegalBreaks(), where the exception was thrown. 
Seems like the implementations of both methods were meant to be analogous, but
got out of alignment.
Proposal is to fix this by merging the implementations into one private method,
as they were almost identical anyway (apart from 3-4 lines, which can be
handled rather gracefully through conditionals).
For now, the proposed fix does not alter the behavior in any way, except by
avoiding the potential ClassCastException, although it did get me wondering
whether the treatment of spaces is always correct here... 
Think: consecutive/adjoining spaces with a different precedence value, and
whether it is correct to just add the space's optimum width. Theoretically, it
seems possible that we leave in a break-opportunity that turns out (= after
space-resolution) to leave less content before the break than the constraint
specifies, because we counted 2 spaces here, of which only one is retained in
the eventual output (?)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 48380] ClassCastException when using fox:widow-content-limit

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48380

--- Comment #1 from Matthias Reischenbacher <ma...@gmx.at> 2009-12-11 12:39:39 UTC ---
Created an attachment (id=24699)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24699)
Testcase

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.