https://issues.apache.org/bugzilla/show_bug.cgi?id=47611

           Summary: NPE at InlineStackingLayoutManager.java:320
           Product: Fop
           Version: 0.95
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: pdf
        AssignedTo: fop-dev@xmlgraphics.apache.org
        ReportedBy: ken_...@y7mail.com


; SystemID: file:/var/www/sumo/lib/sumo-pdf.xsl; Line#: 40; Column#: 29
javax.xml.transform.TransformerException: java.lang.NullPointerException
        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Tr
ansformerImpl.java:2416)
        at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResul
t.java:1374)
        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Tr
ansformerImpl.java:2411)
        at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Tran
sformerImpl.java:2281)
        at
org.apache.xalan.transformer.TransformerImpl.transformNode(Transforme
rImpl.java:1367)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:709)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:1284)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:1262)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:214)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:125)
        at org.apache.fop.cli.Main.startFOP(Main.java:166)
        at org.apache.fop.cli.Main.main(Main.java:197)
Caused by: java.lang.NullPointerException
        at
org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.applyChan
ges(InlineStackingLayoutManager.java:320)
        at
org.apache.fop.layoutmgr.inline.LineLayoutManager.findHyphenationPoin
ts(LineLayoutManager.java:1480)
        at
org.apache.fop.layoutmgr.inline.LineLayoutManager.findOptimalBreaking
Points(LineLayoutManager.java:950)
        at
org.apache.fop.layoutmgr.inline.LineLayoutManager.createLineBreaks(Li
neLayoutManager.java:917)
        at
org.apache.fop.layoutmgr.inline.LineLayoutManager.getNextKnuthElement
s(LineLayoutManager.java:607)
        at
org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthEleme
nts(BlockStackingLayoutManager.java:294)
...

I have patched it by doing on the 0.95 source.

--- InlineStackingLayoutManager.java.orig       2008-08-01 00:02:58.000000000
+1000
+++ InlineStackingLayoutManager.java    2009-07-30 17:57:05.000000000 +1000
@@ -317,8 +317,9 @@
         KnuthElement oldElement;
         while (oldListIterator.hasNext()) {
             oldElement = (KnuthElement) oldListIterator.next();
-            oldElement.setPosition
-                (((NonLeafPosition) oldElement.getPosition()).getPosition());
+            NonLeafPosition pos = (NonLeafPosition) oldElement.getPosition();
+            if (pos != null)
+                oldElement.setPosition(pos.getPosition());
         }
         // reset the iterator
         oldListIterator = oldList.listIterator();

A different patch, https://issues.apache.org/bugzilla/show_bug.cgi?id=45667 has
already been applied with no effect.

I don't understand the code so this is just a workaround from me. I can attach
the .fo file, but it's 140kB. If you don't mind, I can do that. I know I should
trim it to a small example, but as it seems to be something to do with
hyphenation, I may remove the bug if I do that. Besides, it's pretty obvious
that it crashes when I feed the .fo file to fop. This seems to be a rather rare
bug, it's the first time I've seen it in two years of using FOP in production.

Should I try building fop.jar from trunk? It doesn't look like there have been
any changes checked in for a while.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to