Summary: | LayoutException when rendering ./examples/fo/basic/blockcontainer.fo | ||
---|---|---|---|
Product: | Fop - Now in Jira | Reporter: | Adrian Cumiskey <dev> |
Component: | page-master/layout | Assignee: | fop-dev |
Status: | NEW --- | ||
Severity: | normal | CC: | taffy-tyler6464 |
Priority: | P3 | ||
Version: | all | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux | ||
Attachments: | Proposed patch |
Description
Adrian Cumiskey
2009-03-09 01:54:42 UTC
FWIW: in spite of the fact that this bug is marked as applicable to 'ALL' versions, I cannot reproduce the issue with FOP Trunk on Mac OS X (tried rendering to PDF or AWT). Sorry, a bit too quick, but there is a logical explanation: I had commented out the last fo:block-container, which has a overflow='error-if-overflow', so the fact that you get an exception is expected. I should have looked at the FO more closely... still, this is not a very good example for someone wanting to try FOP out. It would be better to remove the error on overflow and generate some useful output for the user. WDYT? (In reply to comment #3) > I should have looked at the FO more closely... still, this is not a very good > example for someone wanting to try FOP out. It would be better to remove the > error on overflow and generate some useful output for the user. WDYT? Good idea. Indeed, a dubious demo file. :-) The spec says: error-if-overflow: This value implies the same semantics as the value "hidden" with the additional semantic that an error shall be indicated; implementations may recover by clipping the region. The code says: boolean canRecover = (getBlockContainerFO().getOverflow() != EN_ERROR_IF_OVERFLOW); (BlockContainerLayoutManager, line 533). Does that not mean that the code is wrong: it should recover, but issue an ERROR instead of a WARNING? (In reply to comment #5) > The spec says: error-if-overflow: This value implies the same semantics as the > value "hidden" with the additional semantic that an error shall be indicated; > implementations may recover by clipping the region. > > The code says: boolean canRecover = (getBlockContainerFO().getOverflow() != > EN_ERROR_IF_OVERFLOW); (BlockContainerLayoutManager, line 533). > > Does that not mean that the code is wrong: it should recover, but issue an > ERROR instead of a WARNING? The spec says "may recover", it doesn't say "should recover", so it isn't technically wrong. That doesn't mean it can't be changed. But my personal expectation is an error if I explicitely say "error-if-overflow" instead of "hidden". If I say "hidden" I don't care if any content is lost. Created attachment 23407 [details]
Proposed patch
Would the attach patch solve the problem in a good way?
(In reply to comment #7) > Created an attachment (id=23407) [details] > Proposed patch > > Would the attach patch solve the problem in a good way? I think you're doing pretty much the same thing I did there, only in reverse. I specified the event for FATAL level, and "canRecover" can lower the severity to WARN. Your change would set the default level to WARN and increase it to ERROR if it's error-on-overflow. The only difference is that the error cause used FATAL before and uses ERROR after the change which would effectively not stop the formatting and allow the user to increase the event severity to FATAL if he so chooses. You could skip the isError attribute and just set all overflow events to ERROR level by default (Javadoc @event.severity). That would have the same effect. Don't forget that the block-container case is not the only overflow where an error is possible. As I said before I'm not opposed to lowering FATAL to ERROR for "error-if-overflow". A custom event handler can always throw an exception. resetting P2 open bugs to P3 pending further review |