Bug 47611 - NPE at InlineStackingLayoutManager.java:320
Summary: NPE at InlineStackingLayoutManager.java:320
Status: CLOSED DUPLICATE of bug 50276
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: pdf (show other bugs)
Version: trunk
Hardware: PC Linux
: P2 major
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-30 16:39 UTC by Ken Yap
Modified: 2012-04-01 13:42 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ken Yap 2009-07-30 16:39:47 UTC
; 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.
Comment 1 Matthias Reischenbacher 2010-12-19 09:27:36 UTC

*** This bug has been marked as a duplicate of bug 50276 ***
Comment 2 Glenn Adams 2012-04-01 13:42:53 UTC
batch transition to closed for remaining resolved bugs