Bug 39712

Summary: NullPointerExeption on table with border-separation="[value]"
Product: Fop - Now in Jira Reporter: diethard <diethard.kumpf>
Component: fo treeAssignee: fop-dev
Status: CLOSED FIXED    
Severity: critical CC: boris_k, diethard.kumpf, jeff
Priority: P1 Keywords: FixedInTrunk
Version: 0.92   
Target Milestone: ---   
Hardware: PC   
OS: Windows Server 2003   
URL: http://www.dimari.de

Description diethard 2006-06-03 13:35:01 UTC
In the new FOP Version we got the NullPointerExeption always when we use the 
attribute "border-separation" on table. This bug is easy to find. Try the 
following xsl.

Background: the new altova stylevision 2006 make intensive use of border-
separation when you want to design tables. The previous version had a different 
handling. That was the reason why the bug was discovered.
Because of the advantages of FOP 0.92 we don't want to go back to FOP 0.20.5 
(this Version has no problems).

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:fo="http://www.w3.org/1999/XSL/Format" 
xmlns:fn="http://www.w3.org/2005/xpath-functions" 
xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" 
xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xsl:output version="1.0" method="html" encoding="UTF-8" indent="no" />
    <xsl:variable name="fo:layout-master-set">
        <fo:layout-master-set>
            <fo:simple-page-master master-name="default-page" page-
height="11in" page-width="8.5in" margin-left="0.6in" margin-right="0.6in">
                <fo:region-body margin-top="0.79in" margin-bottom="0.79in" />
            </fo:simple-page-master>
        </fo:layout-master-set>
    </xsl:variable>
    <xsl:template match="/">
        <xsl:variable name="maxwidth" select="7.30000" />
        <fo:root>
            <xsl:copy-of select="$fo:layout-master-set" />
            <fo:page-sequence master-reference="default-page" initial-page-
number="1" format="1">
                <fo:flow flow-name="xsl-region-body">
                    <fo:block>
                        <xsl:variable name="tablewidth0" select="$maxwidth * 
1.00000" />
                        <xsl:variable name="sumcolumnwidths0" 
select="0.04167" />
                        <xsl:variable name="defaultcolumns0" select="1" />
                        <xsl:variable name="defaultcolumnwidth0">
                            <xsl:choose>
                                <xsl:when test="$defaultcolumns0 &gt; 0">
                                    <xsl:value-of select="($tablewidth0 - 
$sumcolumnwidths0) div $defaultcolumns0" />
                                </xsl:when>
                                <xsl:otherwise>
                                    <xsl:value-of select="0.000" />
                                </xsl:otherwise>
                            </xsl:choose>
                        </xsl:variable>
                        <xsl:variable name="columnwidth0_0" 
select="$defaultcolumnwidth0" />
                        <fo:table table-layout="fixed" width="{$tablewidth0}in" 
space-before.optimum="1pt" space-after.optimum="2pt" border-collapse="separate" 
border-separation="0.04167in" color="black" display-align="center">
                            <fo:table-column column-width="{$columnwidth0_0}
in" />
                            <fo:table-body>
                                <fo:table-row>
                                    <fo:table-cell padding-top="0.02083in" 
padding-bottom="0.02083in" padding-left="0.02083in" padding-right="0.02083in">
                                        <fo:block padding-top="1pt" padding-
bottom="1pt">
                                            <fo:inline>
                                                <xsl:text>fg</xsl:text>
                                            </fo:inline>
                                        </fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                            </fo:table-body>
                        </fo:table>
                    </fo:block>
                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>
</xsl:stylesheet>
Comment 1 Andreas L. Delmelle 2006-06-08 09:34:37 UTC
Sorry for the delay in responding to this... 

Confirmed: I altered our testcase 'table-border-separate3.xml' to use border-separation="...", and the 
test no longer completes succesfully, although I don't receive a NPE during the test cycle (again: a 
completely empty area tree is the result).

Running the FO standalone throws an NPE with the following stack trace:

java.lang.NullPointerException
        at org.apache.fop.fo.properties.CompoundPropertyMaker.convertProperty
(CompoundPropertyMaker.java:172)
        at org.apache.fop.fo.properties.LengthPairProperty$Maker.convertProperty
(LengthPairProperty.java:61)
        at org.apache.fop.fo.properties.PropertyMaker.make(PropertyMaker.java:437)
        at org.apache.fop.fo.properties.CompoundPropertyMaker.make(CompoundPropertyMaker.java:
212)
        at org.apache.fop.fo.PropertyList.convertAttributeToProperty(PropertyList.java:355)
        at org.apache.fop.fo.PropertyList.addAttributesToList(PropertyList.java:305)
        at org.apache.fop.fo.FObj.processNode(FObj.java:122)
        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:318)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:185)
Comment 2 Andreas L. Delmelle 2006-06-08 09:45:40 UTC
FWIW, just ran a second test, specifying the border-separation fully, like:

border-separation.block-progression-direction="..."
border-separation.inline-progression-direction="..."

and then the test completes succesfully.
Comment 3 Andreas L. Delmelle 2006-06-08 10:10:06 UTC
Fixed in FOP Trunk: http://svn.apache.org/viewvc?rev=412714&view=rev

Thanks for reporting!
Comment 4 Andreas L. Delmelle 2006-08-04 19:51:44 UTC
*** Bug 40186 has been marked as a duplicate of this bug. ***
Comment 5 Andreas L. Delmelle 2006-10-12 09:59:45 UTC
*** Bug 40744 has been marked as a duplicate of this bug. ***
Comment 6 Glenn Adams 2012-04-01 07:08:31 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed