Free Support Forum - groupdocs.com

PDF comparison without null pointer exception in Java

Hello

I just downloaded your demo Java Comparison project and set my trial lisence. I’m getting a null pointer in this line:

result.saveDocument(Utilities.outputFileName(".pdf"));

Error is:

Exception in thread “main” java.lang.NullPointerException
at com.groupdocs.comparison.examples.PdfDocumentsComparision.ComparePdfFromFileWithoutSettings(PdfDocumentsComparision.java:23)
at com.groupdocs.comparison.examples.MainClass.main(MainClass.java:21)

Any ideas?

@iahemmin,

Can you please share the problematic files (source and target) and sample code with us? Also share the API version that you integrated.

Version 19.3
Used source and target PDF from the demo project. source.pdf (80.3 KB)
target.pdf (80.4 KB)
Thanks for your time

@iahemmin,

Please share sample code as well.

Main: https://pastebin.com/v3tm5qBg
PDFDocument: https://pastebin.com/D3ZrcCSj
Utilities: https://pastebin.com/cXSzpAFt

I really just took the supplied example end deleted the unneeded methods.

@iahemmin,

We couldn’t reproduce this issue at our end. Please find the resultant file attached - output.zip (95.3 KB)
However, in order to further investigate this issue, we need following information:

  • Your complete console application/project
  • Operating system and its version
  • IDE that you are using

Thank you for taking your time!
Groupdocs.zip (905.4 KB)
macOS Mojave 10.14.4 (18E226)
IntelliJ 2018.3.5
JDK 10

Any suggestions what I should try?

I’ve debugged the code and found that the result is null. All files are beeing found and are valid.

@iahemmin,

Do you face this issue just in case of PDF comparison? Can you please check this with some other file format (Word)? Please share a screencast of this scenario as well.
We’d appreciate your cooperation in this regard.

I’m getting this error while running a comparison ond a word document:

Caused by: class com.groupdocs.comparison.internal.c.a.s.exceptions.ArgumentException: Culture Name: en-CH is not a supported culture

I’m happy to upload a short video while running the code. You can expect it here in roughly three hours.

Thanks

1 Like

Just ran your docker image and am encountering the same problem.

Logs: docker.txt.zip (3.4 KB)

@iahemmin,

Thanks for sharing the details. We’ll appreciate if you cover both scenarios in the screencast.

Sorry for letting you wait had a lot of things to do.

You can find the video here: https://youtu.be/57nSLnoDPEU

Please tell me if you need any further information from my side I’m happy to help!

1 Like

@iahemmin,

Thanks for sharing the video.
This seems to be a environment based issue. We are further investigating it at our end. Your investigation ticket ID is COMPARISONJAVA-586.
As we have any futher update on this, we’ll surely notify you.

Hi,

Even i am getting same Null pointer Exception as above while comparing 2 PDF files. My Environment details are as below.

OS : Windows 10 64 bit
JDK : jdk1.8.0_112
IDE : Eclipse neon (4.6.0)

@ashwin1483,

Your query is addressed here.

@iahemmin,

Can you please confirm if you get Null pointer exception using attached files?
testsource.pdf (2.1 KB)
testtarget.pdf (2.4 KB)

The result which gets returned is still null.

@iahemmin,

This could be because of missing fonts. Can you please confirm if Times New Roman is installed in your environment? If no, then install the font and do comparison again.

Times New Roman is installed on my environment.

@iahemmin,

We are further investigating this.