Bug 32253 - Marker bugs
Summary: Marker bugs
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: 2004-11-15 20:28 UTC by Andreas L. Delmelle
Modified: 2012-04-01 06:48 UTC (History)
0 users



Attachments
FO to demonstrate described problems (1.86 KB, text/plain)
2004-11-15 20:30 UTC, Andreas L. Delmelle
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas L. Delmelle 2004-11-15 20:28:06 UTC
Issues to follow up:

- Absent markers lead to ClassCastException in 
    LineLM.getNextBreakPoss() line 409 preceded by message (in RetrieveMarkerLM)
    "found no marker with name: ..."

- Markers with only a CDATA child node leads to ClassCastException in
    Marker.rebind() line 72

- Markers with fo:block child node leads to ClassCastException in 
    LineLM.getNextBreakPoss() line 409 preceded by message (in RetrieveMarkerLM)
    "retrieved: org.apache.fop.layoutmgr.InlineStackingLM..."
Comment 1 Andreas L. Delmelle 2004-11-15 20:30:08 UTC
Created attachment 13470 [details]
FO to demonstrate described problems
Comment 2 Simon Pepping 2004-11-15 22:06:12 UTC
I implemented InlineLevelLM in RetrieveMarkerLM. That cures some of the
ClassCast Exceptions. The exceptions in Marker.rebind are due to the recent
change of FOText from FObj to FONode. That change has not yet been made in this
method.
Comment 3 Andreas L. Delmelle 2004-11-15 22:38:55 UTC
Thanks for the assist, Simon.

I noticed the problem in Marker.rebind() as well... and was wondering

Since:
1. all FObjs are also FONodes
2. FOText has its own bind() method

maybe we could cast i.next() to FONode first, to check the base class:
FONode childNode = (FONode) i.next();

Then test:
if( childNode.getClass().equals("class org.apache.fop.fo.FOText") )

And based upon the result of that test, cast to either FObj or FOText...

Sound like a good idea, or would this be classified as 'sloppy'?
(Alternative could be to try-and-catch the ClassCastException, but IIRC this is 
considered bad practice...)

BTW: stumbled upon the Joerg's favourite dreadful nested 'block-inline-block' 
problem --which throws ClassCastExceptions in InlineLayoutManager
Comment 4 Andreas L. Delmelle 2004-11-15 22:44:59 UTC
On second thought... simply using:

if( childNode.getName() == null )

seems even better to test whether it's an FObj.
Comment 5 Andreas L. Delmelle 2004-11-15 22:53:26 UTC
...but this leads to yet another CCE, this time in 
  RetrieveMarkerLM.getNextKnuthElements() line 82
Comment 6 Andreas L. Delmelle 2004-11-15 22:59:29 UTC
...due to the retrieved LM being an InlineStackingLM?? Where does that come 
from? Shouldn't that be a TextLM?
Comment 7 Glen Mazza 2004-11-16 00:45:34 UTC
[Andreas]

>Then test:
>if( childNode.getClass().equals("class org.apache.fop.fo.FOText") )

Just using instanceof (i.e., childNode instanceof FOText) should be
sufficient--I implemented a similar change in fo.flow.Block when I switched text
nodes from FObj to FONode.

Thanks, (and sorry for the oversight--let me know if I can be of help here)
Glen
Comment 8 Andreas L. Delmelle 2004-11-16 00:56:16 UTC
Yes! I just *knew* there was a much more obvious way of testing that.

Thanks Glen (--still enjoying himself in Vegas, I presume?)
Comment 9 Simon Pepping 2004-11-30 21:23:28 UTC
Committed a fix in Marker, which cures the ClassCastException in
Marker.rebind(). Now all markers lead to a ClassCastException in
RetrieveMarkerLM.getNextKnuthElements(), line 81. This should be cured by
removing the LMs for fo:marker and for fo:retrieve-marker:

at the moment, RetrieveMarkerLM tries to achieve this (in the LM tree):

         ...
          |
       parentLM
          |
  RetrieveMarkerLM
          |
  InlineStackingLM
       ---+---
       |     |
  chldLM1   chldLM2

but, as a marker can only have children which could replace its
retrieve-marker, wouldn't it be better to have just:

         ...
          |
       parentLM
       ---+---
       |     |
  chldLM1   chldLM2

(Luca Furini at fop-dev)
Comment 10 Simon Pepping 2004-12-07 21:12:25 UTC
Removed RetrieveMarkerLM. The LMs of the marker children are attached in the LM
tree as the direct children of the LM of the parent of the RetrieveMarker.
Comment 11 Glenn Adams 2012-04-01 06:48:44 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed