我不确定此错误消息实际上指向什么。需要明确的是,我知道 NullPointerException 是什么,但我无法弄清楚不应该是什么 null。有人知道是什么导致这个错误是空的吗?
谢谢。
com.lowagie.text.DocumentException: java.lang.NullPointerException
at com.lowagie.text.pdf.PdfDocument.add(Unknown Source)
at com.lowagie.text.Document.add(Unknown Source)
...
Caused by: java.lang.NullPointerException
at com.lowagie.text.pdf.PdfPTable.getRowHeight(Unknown Source)
at com.lowagie.text.pdf.PdfPTable.calculateHeights(Unknown Source)
at com.lowagie.text.pdf.PdfPTable.setTotalWidth(Unknown Source)
at com.lowagie.text.pdf.ColumnText.goComposite(Unknown Source)
at com.lowagie.text.pdf.ColumnText.go(Unknown Source)
at com.lowagie.text.pdf.PdfPCell.getMaxHeight(Unknown Source)
at com.lowagie.text.pdf.PdfPRow.calculateHeights(Unknown Source)
at com.lowagie.text.pdf.PdfPRow.getMaxHeights(Unknown Source)
at com.lowagie.text.pdf.PdfPTable.getRowHeight(Unknown Source)
at com.lowagie.text.pdf.PdfPTable.calculateHeights(Unknown Source)
at com.lowagie.text.pdf.PdfPTable.setTotalWidth(Unknown Source)
at com.lowagie.text.pdf.ColumnText.goComposite(Unknown Source)
at com.lowagie.text.pdf.ColumnText.go(Unknown Source)
at com.lowagie.text.pdf.ColumnText.go(Unknown Source)
at com.lowagie.text.pdf.PdfDocument.addPTable(Unknown Source)
... 97 more
有问题的代码:
this.getDocument().open();
Element body = this.getBody();
System.out.println(body);
System.out.println(this.getDocument().toString());
this.getDocument().add(body);//it errors out here!
this.getDocument().close();
调试语句返回:
com.lowagie.text.pdf.PdfPTable@1fa0c8f
com.lowagie.text.Document@14eb497