Jasper 报告中出现 NullPointerException?

发布于 2024-12-17 17:42:42 字数 1875 浏览 0 评论 0原文

当我使用 jasper 报告(版本 1.2.4)导出报告时,它会抛出 NPE。而且我在网上找不到任何解决该问题的方法。有人可以在这方面帮助我吗?

如果我删除报告中的一列有问题的列并将其导出,则它可以正常导出。无法找到该列的问题所在,因为它包含大量数据。

非常感谢!

将异常发布如下:

java.lang.NullPointerException|

at java.awt.font.TextLayout.getBaselineFromGraphic(Unknown Source)|

at java.awt.font.TextMeasurer.initAll(Unknown Source)|

at java.awt.font.TextMeasurer.<init>(Unknown Source)|

at java.awt.font.LineBreakMeasurer.<init>(Unknown Source)|

at java.awt.font.LineBreakMeasurer.<init>(Unknown Source)|

at net.sf.jasperreports.engine.fill.TextMeasurer.renderParagraph(TextMeasurer.java:259)|

at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:220)|

at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:528)|

at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:501)|

at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:345)|

at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:311)|

at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:275)|

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1291)|

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:631)|

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:248)|

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:132)|

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:750)|

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:666)|

at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)|

at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)

When I export a report using jasper report (version 1.2.4), it throws NPE. And I cant find any solution to the problem online. Can anyone help me in this regard please?

If I remove one problematic column in my report and export it, it exports fine. Couldn't find whats the problem with that column as it contains large data.

Many Thanks in Advance !

Posting the exception below :

java.lang.NullPointerException|

at java.awt.font.TextLayout.getBaselineFromGraphic(Unknown Source)|

at java.awt.font.TextMeasurer.initAll(Unknown Source)|

at java.awt.font.TextMeasurer.<init>(Unknown Source)|

at java.awt.font.LineBreakMeasurer.<init>(Unknown Source)|

at java.awt.font.LineBreakMeasurer.<init>(Unknown Source)|

at net.sf.jasperreports.engine.fill.TextMeasurer.renderParagraph(TextMeasurer.java:259)|

at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:220)|

at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:528)|

at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:501)|

at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:345)|

at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:311)|

at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:275)|

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1291)|

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:631)|

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:248)|

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:132)|

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:750)|

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:666)|

at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)|

at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦在夏天 2024-12-24 17:42:42

您可以使用纯 JRE 代码得到完全相同的错误,如下所示:

@Test
public void testText()
{
    String text = "\uFFFF\u0300";
    JTextArea textArea = new JTextArea(text);
    JOptionPane.showMessageDialog(null, textArea);
}

因此,我一直假设这是一个 JRE 错误并已将其提交给 Oracle。解决方法大概是剔除导致它的任何字符序列,但我显然不知道你在输入什么。

You can get the exact same error using pure JRE code, like this:

@Test
public void testText()
{
    String text = "\uFFFF\u0300";
    JTextArea textArea = new JTextArea(text);
    JOptionPane.showMessageDialog(null, textArea);
}

Because of this, I have been assuming it's a JRE bug and already submitted it to Oracle. The workaround is presumably to cull whatever character sequence is causing it, but I obviously don't know what you are feeding in.

娇女薄笑 2024-12-24 17:42:42

这可能是 (1) 您正在使用的 JRE 版本中的错误,或 (2) 线程错误。在我从事的项目中,我们在堆栈跟踪中具有相同的前五行。

This is likely either (1) a bug in the version of the JRE you're using, or (2) a threading bug. We've had the same top five lines in stack traces in a project I work on.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文