Bug 36248 - total number of pages with empty block :ClassCastException in KnuthInlineBox
Summary: total number of pages with empty block :ClassCastException in KnuthInlineBox
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 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-18 16:08 UTC by Thomas Winkler
Modified: 2012-04-01 07:04 UTC (History)
1 user (show)



Attachments
total pages bug (905 bytes, text/plain)
2005-08-18 16:10 UTC, Thomas Winkler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Winkler 2005-08-18 16:08:12 UTC
I tried to get total numer of pages as described in
http://xml.apache.org/fop/fo.html#fo-total-pages.

The following sample.fo works fine with Fop 0.20.5 but it crashes with Fop
1.0dev with the following message :

Exception
:java.lang.ClassCastException :
org.apache.fop.layoutmgr.inline.KnuthInlineBox


<?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 
	margin-right="1.5cm"
	margin-left="1.5cm"
	margin-bottom="2cm"
	margin-top="1cm"
	page-width="21cm"
	page-height="29.7cm"
	master-name="first">
      <fo:region-body margin-top="1cm" margin-bottom="1.5cm"/>
      <fo:region-before extent="1cm"/>
      <fo:region-after extent="1.5cm"/>
    </fo:simple-page-master>
   </fo:layout-master-set>
  <fo:page-sequence master-reference="first">
  <fo:static-content flow-name="xsl-region-after">
	<fo:block>
    
    <fo:inline line-height="14pt" font-size="10pt" >page 
      <fo:page-number/>/<fo:page-number-citation ref-id="last-page"/>
	</fo:inline>
	
	</fo:block>
    </fo:static-content>  
 <fo:flow flow-name="xsl-region-body">
 	<fo:block id="last-page"/>	
	</fo:flow>   
</fo:page-sequence>
</fo:root>
Comment 1 Thomas Winkler 2005-08-18 16:10:49 UTC
Created attachment 16096 [details]
total pages bug
Comment 2 Jeremias Maerki 2005-08-19 09:57:54 UTC
Definitely a side-effect from the inline-block work I thought could be done 
cheaply by mixing lists of KnuthSequences and lists of KnuthElements. Thomas' 
example hits an area which isn't covered by the existing tests so I hadn't 
found the problem. Looks like it is probably safer to do it consistently like 
Simon preferred even if it means creating more container instances. I'll look 
into it ASAP.
Comment 3 Simon Pepping 2005-08-19 20:57:42 UTC
InlineLM does not check whether it receives a list of KnuthElements or of
KnuthSequences, like LineLM does. It blindly assumes the latter, while
PageNumberLM returns the former. Hence the wrong cast to a KnuthSequence. A
cheap solution would be to let InlineLM do the same as LineLM. That is not fail
safe but would cover very many cases.
Comment 4 Jeremias Maerki 2005-08-20 20:30:19 UTC
Should be fixed now. SVN revs:
http://svn.apache.org/viewcvs?rev=234042&view=rev
http://svn.apache.org/viewcvs?rev=234033&view=rev
Comment 5 Glenn Adams 2012-04-01 07:04:25 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed