Jason Harrop created FOP-3349:
---------------------------------

             Summary: NullPointerException in LineLayoutManager's line breaking 
when a line overflows beside a float wider than the measure
                 Key: FOP-3349
                 URL: https://issues.apache.org/jira/browse/FOP-3349
             Project: FOP
          Issue Type: Bug
          Components: layout/line
    Affects Versions: main, 2.11
            Reporter: Jason Harrop


LineLayoutManager.LineBreakingAlgorithm.updateData2 reports a line that does 
not fit through curChildLM:

{code:java}
if (curChildLM.getFObj() == null) {
    eventProducer.lineOverflows(this, getFObj().getName(), ...);
} else {
    eventProducer.lineOverflows(this, curChildLM.getFObj().getName(), ...);
}
{code}

On the float re-layout pass (PageBreaker.handleFloatLayout), curChildLM is 
null, so a line that overflows there throws a NullPointerException, and the 
document fails, instead of the overflow being reported.

h3. To reproduce

{code:xml}
<fo:block><fo:float float="start"><fo:block-container width="480pt" 
height="200pt">
  <fo:block> </fo:block></fo:block-container></fo:float></fo:block>
<fo:block><fo:block>block child</fo:block><fo:inline>Overflowing
  
ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ</fo:inline></fo:block>
{code}

in a region 425pt wide. It fails on 2.11 and on main.

h3. Fix

Test curChildLM == null as well as getFObj() == null, so the overflow is 
reported against the line manager's own FO, as it already is when the child has 
no FO. The code only reports; layout does not change. Layout test 
float_overflow_relayout.xml fails before with the NullPointerException.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to