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 2010/02/24 10:44:24 UTC

DO NOT REPLY [Bug 48806] New: Nested inline elements with text-align attribute cause an Exception

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

           Summary: Nested inline elements with text-align attribute cause
                    an Exception
           Product: Fop
           Version: 0.95
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: pdf
        AssignedTo: fop-dev@xmlgraphics.apache.org
        ReportedBy: kkapelon@freemail.gr


Created an attachment (id=25049)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25049)
Sample FO file that triggers the bug

I am using FOP 0.95 (latest stable at the time of writing) and attached FO
file.

I convert it to PDF with

fop -fo exception.fo sample.PDF

Expected output:
A PDF file

Actual output

The following exception:

java.lang.ClassCastException: org.apache.fop.layoutmgr.LeafPosition cannot be
cast to org.apache.fop.layoutmgr.NonLeafPosition
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:217)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:125)
        at org.apache.fop.cli.Main.startFOP(Main.java:166)
        at org.apache.fop.cli.Main.main(Main.java:197)

If I remove either the inline elements or the text-align attribute the
exception goes away

-- 
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 48806] Nested inline elements with text-align attribute cause an Exception

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

--- Comment #1 from Venkat Reddy <va...@googlemail.com> 2010-02-24 10:40:49 UTC ---
I have tried to reproduce the problem, I haven't got the same exception, but a
NullpointerException...

Listening for transport dt_socket at address: 5005
24-Feb-2010 10:39:35 org.apache.fop.apps.FopFactoryConfigurator configure
INFO: Default page-height set to: 11in
24-Feb-2010 10:39:35 org.apache.fop.apps.FopFactoryConfigurator configure
INFO: Default page-width set to: 8.26in
24-Feb-2010 10:39:35 org.apache.fop.events.LoggingEventListener processEvent
WARNING: The following feature isn't implemented by Apache FOP, yet:
table-layout="auto" (on fo:table) (See position 18:15)
24-Feb-2010 10:39:35 org.apache.fop.events.LoggingEventListener processEvent
WARNING: The following feature isn't implemented by Apache FOP, yet:
table-layout="auto" (on fo:table) (See position 25:21)
24-Feb-2010 10:39:35 org.apache.fop.cli.Main startFOP
SEVERE: Exception
java.lang.NullPointerException
        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)

---------

java.lang.NullPointerException
        at
org.apache.fop.layoutmgr.inline.TextLayoutManager.addALetterSpaceTo(TextLayoutManager.java:793)
        at
org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.addALetterSpaceTo(InlineStackingLayoutManager.java:226)
        at
org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.addALetterSpaceTo(InlineStackingLayoutManager.java:226)
        at
org.apache.fop.layoutmgr.InlineKnuthSequence.addALetterSpace(InlineKnuthSequence.java:133)
        at
org.apache.fop.layoutmgr.InlineKnuthSequence.appendSequence(InlineKnuthSequence.java:76)
        at
org.apache.fop.layoutmgr.KnuthSequence.appendSequenceOrClose(KnuthSequence.java:93)
        at
org.apache.fop.layoutmgr.inline.InlineLayoutManager.getNextKnuthElements(InlineLayoutManager.java:328)
        at
org.apache.fop.layoutmgr.inline.InlineLayoutManager.getNextKnuthElements(InlineLayoutManager.java:309)
        at
org.apache.fop.layoutmgr.inline.InlineLayoutManager.getNextKnuthElements(InlineLayoutManager.java:309)
        at
org.apache.fop.layoutmgr.inline.LineLayoutManager.collectInlineKnuthElements(LineLayoutManager.java:639)
        at
org.apache.fop.layoutmgr.inline.LineLayoutManager.getNextKnuthElements(LineLayoutManager.java:579)
        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.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.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.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.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:692)
        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:337)
        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 48806] Nested inline elements with text-align attribute cause an Exception

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

-- 
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 48806] Nested inline elements with text-align attribute cause an Exception

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

--- Comment #6 from Glenn Adams <gl...@skynav.com> 2012-04-07 01:44:55 UTC ---
resetting P2 open bugs to P3 pending further review

-- 
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 48806] Nested inline elements with text-align attribute cause an Exception

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

--- Comment #3 from Peter Hancock <pe...@gmail.com> 2010-02-24 11:08:12 UTC ---
The bug seems to be caused by the no-break space (u+a0) between the first
fo:inline elemet of
<fo:inline> </fo:inline>World</fo:inline></fo:inline>

changing it to a regular space (u+20) resulted in a successful render.

Replace <fo:inline> </fo:inline> by
<fo:inline>&#xa0;</fo:inline> 
and 
<fo:inline>&#x20;</fo:inline>
to demonstrate this.

However,this should still be recognised as a bug in fop.

I can verify that this bug still exists in the trunk, with a different
exception stack
...
Caused by: java.lang.NullPointerException
    at
org.apache.fop.layoutmgr.inline.TextLayoutManager.addALetterSpaceTo(TextLayoutManager.java:851)
    at
org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.addALetterSpaceTo(InlineStackingLayoutManager.java:224)
    at
org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.addALetterSpaceTo(InlineStackingLayoutManager.java:224)
    at
org.apache.fop.layoutmgr.InlineKnuthSequence.addALetterSpace(InlineKnuthSequence.java:133)
    at
org.apache.fop.layoutmgr.InlineKnuthSequence.appendSequence(InlineKnuthSequence.java:76)
    at
org.apache.fop.layoutmgr.KnuthSequence.appendSequenceOrClose(KnuthSequence.java:93)
    at
org.apache.fop.layoutmgr.inline.InlineLayoutManager.getNextKnuthElements(InlineLayoutManager.java:330)
...

-- 
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 48806] Nested inline elements with text-align attribute cause an Exception

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

--- Comment #4 from Kostis Kapelonis <kk...@freemail.gr> 2010-02-24 13:22:47 UTC ---
Thank you very much for you quick reply!

I have to add however that with FOP 0.95 the exception goes away 

1. if text-align attribute is removed OR
2. if the non-breakspace is replaced with a space (as Peter Hancock said) OR
3. if the inline element that contains the non-breaking space is removed but
the non-breaking space itself stays OR
4. If a word is inserted before the non-breaking space OR
5. If a word is inserted after the non-breaking space

So it seems to me that the combination of span + contents of non-breaking space
and nothing else is the problem. As for text-align I have no clue!

-- 
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 48806] Nested inline elements with text-align attribute cause an Exception

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

taffy-tyler6464@hotmail.co.uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |taffy-tyler6464@hotmail.co.
                   |                            |uk

-- 
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 48806] Nested inline elements with text-align attribute cause an Exception

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

--- Comment #2 from Venkat Reddy <va...@googlemail.com> 2010-02-24 10:41:55 UTC ---
I have used Fop Trunk version to get that above NullpointerException

-- 
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 48806] Nested inline elements with text-align attribute cause an Exception

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

--- Comment #5 from Peter Hancock <pe...@gmail.com> 2010-02-24 14:13:20 UTC ---
Created an attachment (id=25051)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25051)
A cut down example

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