Fop
  1. Fop
  2. FOP-1428

NullPointerException when min-height is specified for table-row

    Details

    • Type: Bug Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: trunk
    • Fix Version/s: None
    • Component/s: layout/unqualified
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: All
    • External issue ID:
      43591

      Description

      When specifying min-height for an fo:table-row, FOP aborts with a
      NullPointerException:

      java.lang.NullPointerException
      at
      org.apache.fop.layoutmgr.table.TableContentLayoutManager.createElementsForRowGroup(TableContentLayoutManager.java:465)
      at
      org.apache.fop.layoutmgr.table.TableContentLayoutManager.getKnuthElementsForRowIterator(TableContentLayoutManager.java:251)
      at
      org.apache.fop.layoutmgr.table.TableContentLayoutManager.getNextKnuthElements(TableContentLayoutManager.java:179)
      at
      org.apache.fop.layoutmgr.table.TableLayoutManager.getNextKnuthElements(TableLayoutManager.java:243)

      Example XSL-FO:

      <?xml version="1.0" encoding="UTF-8"?>
      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
      <fo:simple-page-master master-name="letter"
      page-height="11in"
      page-width="8.5in"
      margin-left="0.75in"
      margin-right="0.75in">
      <fo:region-body margin-bottom="1.0cm" margin-top="0.7cm"/>
      </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="letter">
      <fo:flow flow-name="xsl-region-body">
      <fo:table table-layout="fixed" width="100%">
      <fo:table-column column-width="100%"/>
      <fo:table-body>
      <fo:table-row min-height="3.0em">
      <fo:table-cell>
      <fo:block>Hello</fo:block>
      </fo:table-cell>
      </fo:table-row>
      </fo:table-body>
      </fo:table>
      </fo:flow>
      </fo:page-sequence>
      </fo:root>

        Activity

        Isaac Shabtay created issue -
        Hide
        Chris Bowditch added a comment -

        Confirmed. I tested your FO on the latest code from Trunk and NPE still occurs
        there too

        Show
        Chris Bowditch added a comment - Confirmed. I tested your FO on the latest code from Trunk and NPE still occurs there too
        Hide
        Jeremias Maerki added a comment -

        Right, but we also don't claim that min-height is implemented. See here:
        http://xmlgraphics.apache.org/fop/compliance.html#fo-property-min-height

        block-progression-dimension.minimum does the same thing and that works.

        Show
        Jeremias Maerki added a comment - Right, but we also don't claim that min-height is implemented. See here: http://xmlgraphics.apache.org/fop/compliance.html#fo-property-min-height block-progression-dimension.minimum does the same thing and that works.
        Hide
        Isaac Shabtay added a comment -

        Jeremias, I agree that min-height is declared to be unsupported on 0.94.

        Still, not supporting a feature does not make it "right" to abort on a runtime
        exception such as a NullPointerException.

        fo:table with table-layout="auto" is also not supported; however, using
        table-layout="auto" is handled correctly: A message is displayed saying that it
        is not supported, but processing continues while the unsupported attribute is
        ignored.

        I would expect the same kind of behavior (logging a message & ignoring the
        unsupported attribute) when using min-height.

        Hoping that my claim convinced anybody, I am re-setting severity to Major;
        NullPointerExceptions due to incomplete / unsupported code is an extremely bad
        practice IMO.

        I will attempt to create an Eclipse workspace using the Trunk version and submit
        a patch for it.

        Isaac

        Show
        Isaac Shabtay added a comment - Jeremias, I agree that min-height is declared to be unsupported on 0.94. Still, not supporting a feature does not make it "right" to abort on a runtime exception such as a NullPointerException. fo:table with table-layout="auto" is also not supported; however, using table-layout="auto" is handled correctly: A message is displayed saying that it is not supported, but processing continues while the unsupported attribute is ignored. I would expect the same kind of behavior (logging a message & ignoring the unsupported attribute) when using min-height. Hoping that my claim convinced anybody, I am re-setting severity to Major; NullPointerExceptions due to incomplete / unsupported code is an extremely bad practice IMO. I will attempt to create an Eclipse workspace using the Trunk version and submit a patch for it. Isaac
        Hide
        Andreas L. Delmelle added a comment -

        (In reply to comment #3)
        >
        > Still, not supporting a feature does not make it "right" to abort on a runtime
        > exception such as a NullPointerException.
        <snip />

        Agreed. I'll see if I can add a warning for this unimplemented property.
        Note that 'block-progression-dimension.minimum' is a valid alternative only in certain circumstances
        (depending on reference-orientation and writing-mode). 'b-p-d' is not always the same as 'height'. If it
        were that simple, we'd probably have implemented it already...

        On the same note: since the issue still exists in FOP Trunk, and it is probably safe to say that it can be
        reproduced on all platforms, I have changed those bug-properties as well.

        Show
        Andreas L. Delmelle added a comment - (In reply to comment #3) > > Still, not supporting a feature does not make it "right" to abort on a runtime > exception such as a NullPointerException. <snip /> Agreed. I'll see if I can add a warning for this unimplemented property. Note that 'block-progression-dimension.minimum' is a valid alternative only in certain circumstances (depending on reference-orientation and writing-mode). 'b-p-d' is not always the same as 'height'. If it were that simple, we'd probably have implemented it already... On the same note: since the issue still exists in FOP Trunk, and it is probably safe to say that it can be reproduced on all platforms, I have changed those bug-properties as well.
        Hide
        Andreas L. Delmelle added a comment -

        Bug has been fixed in FOP Trunk, but only now I discovered this related entry.
        The min-height/max-height and min-width/max-width properties have (finally) been activated.

        see: http://svn.apache.org/viewvc?rev=652456&view=rev

        Show
        Andreas L. Delmelle added a comment - Bug has been fixed in FOP Trunk, but only now I discovered this related entry. The min-height/max-height and min-width/max-width properties have (finally) been activated. see: http://svn.apache.org/viewvc?rev=652456&view=rev
        Hide
        Glenn Adams added a comment -

        batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed

        Show
        Glenn Adams added a comment - batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed

          People

          • Assignee:
            fop-dev
            Reporter:
            Isaac Shabtay
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development