Bug 2491 - footnote can't fit remaining space and crash
Summary: footnote can't fit remaining space and crash
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: pdf (show other bugs)
Version: all
Hardware: All other
: P3 critical
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-07-06 17:28 UTC by hin-tak leung
Modified: 2012-04-01 06:34 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hin-tak leung 2001-07-06 17:28:08 UTC
If a paragraph has a few foot notes towards the bottom of the page, and the
footnote body cannot fit into the remaining page, FOP would crash. This patch 
doesn't solve the problem, but it simply trap the error and skip the footnote 
body and output a message after the page number so that the user still get a 
pdf file to visually examine where the missing footnote might be and maybe
rearrange his text to fit. I think this is better than FOP just dying without
generating a pdf file. 

Some better solution may be:
(1) properly move the footnote to next page (i.e. say, last line of
page 1 has a footnote refering to footnote 1, but the footnote body itself
only appears in bottom of page 2).
(2) temperarily lengthen the page content size, get the footnote overhanging 
below the nominal bottom of page and output a message to tell user to rearrange 
his text. 
 
I had a look around Footnote.java and FootnoteBody.java for a few hours but 
neither look too easy, so I gave up. I think ideally the behaviour should
be similar to latex i.e. fit as much of footnote 1 into bottom of page 1,
and output the rest to bottom of page two, but since FOP doesn'timplement 
xsl-footnote-separator yet, this may be a bit confusing visually.

--------------------------------------------
*** /home/LEUNGH2/xml-fop/src/org/apache/fop/fo/flow/FootnoteBody.java-org
	Sun Mar  4 21:34:52 2001
--- /home/LEUNGH2/xml-fop/src/org/apache/fop/fo/flow/FootnoteBody.java	Sat 
Jul  7 00:40:46 2001
***************
*** 108,114 ****
        for ( int i = this.marker; i < numChildren; i++ ) {
  	FONode fo = (FONode) children.elementAt(i);
  	Status status;
! 	if ( (status = fo.layout(blockArea)).isIncomplete() ) {
  	  this.resetMarker();
  	  return status;
  	}
--- 108,125 ----
        for ( int i = this.marker; i < numChildren; i++ ) {
  	FONode fo = (FONode) children.elementAt(i);
  	Status status;
!       try {
!         status = fo.layout(blockArea); 
!       } catch (NullPointerException e) {
!         System.out.println("");
!         System.out.println("***A paragraph near the bottom of the page has a 
footnote");
!         System.out.println("***which is too big to fit into the remaining");
!         System.out.println("***available space. The footnote is being 
skipped.");
!         System.out.println("***Please rewrite the paragraph or the footnote 
body.");
! 	  this.resetMarker();
! 	  return new Status(Status.OK);
!       };
! 	if ( status.isIncomplete() ) {
  	  this.resetMarker();
  	  return status;
  	}
Comment 1 J.Pietschmann 2002-05-06 12:22:50 UTC
Footnotes not fitting on the current page no longer crash FOP. If possible,
the footnote is shifted as a whole to the next page. (See Bug 8819)
Comment 2 Glenn Adams 2012-04-01 06:34:26 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed