Bug 43591 - NullPointerException when min-height is specified for table-row
Summary: NullPointerException when min-height is specified for table-row
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: page-master/layout (show other bugs)
Version: trunk
Hardware: All All
: P2 major
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-10 13:36 UTC by Isaac Shabtay
Modified: 2012-04-01 06:42 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Isaac Shabtay 2007-10-10 13:36:32 UTC
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>
Comment 1 Chris Bowditch 2007-10-11 03:35:36 UTC
Confirmed. I tested your FO on the latest code from Trunk and NPE still occurs 
there too :-(
Comment 2 Jeremias Maerki 2007-10-11 03:45:51 UTC
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.
Comment 3 Isaac Shabtay 2007-10-11 04:41:52 UTC
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
Comment 4 Andreas L. Delmelle 2007-10-11 09:30:03 UTC
(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.
Comment 5 Andreas L. Delmelle 2008-05-02 02:51:50 UTC
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
Comment 6 Glenn Adams 2012-04-01 06:42:30 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed