Erikhht / flying-saucer

Automatically exported from code.google.com/p/flying-saucer
0 stars 0 forks source link

NullPointerException at NoNamespaceHandler.java:139 #148

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use the sample code PDFRender
2. Pass in a file:// url
3. PDF Creates correctly
4. Modify the code so that it reads from a String get the following error:
Exception in thread "main" java.lang.NullPointerException
    at org.xhtmlrenderer.simple.NoNamespaceHandler.getStylesheets(NoNamespaceHandler.java:139)
    at org.xhtmlrenderer.simple.extend.XhtmlCssOnlyNamespaceHandler.getStylesheets(XhtmlCssOnlyNamespaceHandler.java:335)
    at org.xhtmlrenderer.context.StyleReference.getStylesheets(StyleReference.java:244)
    at org.xhtmlrenderer.context.StyleReference.setDocumentContext(StyleReference.java:105)
    at org.xhtmlrenderer.pdf.ITextRenderer.setDocument(ITextRenderer.java:182)
    at org.xhtmlrenderer.pdf.ITextRenderer.setDocument(ITextRenderer.java:145)

Please provide any additional information below.
piNode.getTarget() is null.
Flip the .equals so that the String constant is first and the problem goes away.
if (!"xml-stylesheet".equals(piNode.getTarget())) continue;

Original issue reported on code.google.com by opticyc...@gmail.com on 2 May 2011 at 1:38