1 Reply Latest reply on Jun 14, 2010 7:29 PM by clerum

    NullPointerException when you nest p:*chart inside a p:font

    jvcode
      Hi all,

      today I experienced a little with PDF generation and charts with Seam 2.2.0. I noticed that a NullPointerException is thrown when you put a p:*chart inside a p:font tag.

      For example:
      <p:font>
        <p:piechart>
          <p:data key="key1" value="1"/>
        </p:piechart>
      </p:font>

      leads to the following exception:
      java.lang.RuntimeException: java.lang.NullPointerException
           at org.jboss.seam.pdf.ui.UIChart.createITextObject(UIChart.java:314)
           at org.jboss.seam.pdf.ui.UIChart.encodeEnd(UIChart.java:361)
           at org.jboss.seam.pdf.ui.ITextComponent.encode(ITextComponent.java:300)
      ...
      Caused by: java.lang.NullPointerException
           at com.lowagie.text.pdf.PdfWriter.addSimple(Unknown Source)
           at com.lowagie.text.pdf.PdfContentByte.setFontAndSize(Unknown Source)
           at com.lowagie.text.pdf.PdfGraphics2D.drawString(Unknown Source)
           at org.jfree.text.TextUtilities.drawRotatedString(TextUtilities.java:534)

      If you remove the p:font it is rendered correctly. I haven't read anything in the documentation that this nesting is not allowed. Is that a bug? At least a meaningful exception would be nice if it is not allowed.

      Best Regards.