red6 / pdfcompare

A simple Java library to compare two PDF files
Apache License 2.0
220 stars 66 forks source link

NPE in ICC_Profile.intFromBigEndian #82

Closed SoltauFintel closed 4 years ago

SoltauFintel commented 4 years ago

Do you know what cause this exception?

Caused by: java.lang.NullPointerException
    at java.awt.color.ICC_Profile.intFromBigEndian(ICC_Profile.java:1782)
    at java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1474)
    at sun.java2d.cmm.lcms.LCMSTransform.<init>(LCMSTransform.java:98)
    at sun.java2d.cmm.lcms.LCMS.createTransform(LCMS.java:173)
    at java.awt.color.ICC_ColorSpace.toRGB(ICC_ColorSpace.java:178)
    at org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.init(PDDeviceRGB.java:68)
    at org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.toRGBImage(PDDeviceRGB.java:108)
    at org.apache.pdfbox.pdmodel.PDDocument.<clinit>(PDDocument.java:108)

PdfComparator.compare() was called.

SoltauFintel commented 4 years ago

Just calling new PDDocument(); in begin of main() solves this problem.

finsterwalder commented 4 years ago

No idea. So did I understand your second comment correctly, that you fixed the problem? Then I can close this ticket?

SoltauFintel commented 4 years ago

I will research this a little further, report here and then close the ticket. Other users could also encounter this error. Funnily enough, my JUnit test worked, but it didn't work in the productive Swing app. Could you please write something about my other ticket.

SoltauFintel commented 4 years ago
SoltauFintel commented 4 years ago

I haven't found a better solution than calling new PDDocument() at the beginning of main().