Issue with PDF Compare

Hello,

I ran into a issue while using PDF compare. With 80% of the PDF’s I get this error:

Exception in thread "main" com.groupdocs.comparison.k.c.a: java.lang.IndexOutOfBoundsException: Index 9 out of bounds for length 9
	at com.groupdocs.comparison.k.b.b.ztB(Unknown Source)
	at com.groupdocs.comparison.k.b.b.zsI(Unknown Source)
	at com.groupdocs.comparison.k.b.b.a(Unknown Source)
	at com.groupdocs.comparison.Comparer.b(Unknown Source)
	at com.groupdocs.comparison.Comparer.a(Unknown Source)
	at com.groupdocs.comparison.Comparer.compare(Unknown Source)
	at com.groupdocs.comparison.Comparer.compare(Unknown Source)
	at ch.hamilton.medical.tooling.portal.service.facade.rest.v1.api.CompareRestController.main(CompareRestController.java:61)
Caused by: java.lang.IndexOutOfBoundsException: Index 9 out of bounds for length 9
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
	at java.base/java.util.Objects.checkIndex(Objects.java:372)
	at java.base/java.util.ArrayList.get(ArrayList.java:458)
	at com.groupdocs.comparison.k.f.g.c(Unknown Source)
	at com.groupdocs.comparison.k.f.g.a(Unknown Source)
	at com.groupdocs.comparison.k.f.g.l(Unknown Source)
	at com.groupdocs.comparison.k.f.b.g(Unknown Source)
	at com.groupdocs.comparison.k.f.b.c(Unknown Source)
	at com.groupdocs.comparison.k.f.b.dn(Unknown Source)
	at com.groupdocs.comparison.k.f.b.a(Unknown Source)
	... 8 more

I wrote this example code to test it:

  public static void main(String[] args) {

    License lic = new License();
    lic.setLicense(CompareRestController.class.getClassLoader().getResourceAsStream("GroupDocLicense/GroupDocs.ComparisonforJava.lic"));

    var requestingPath = "C:/Users/AClavadetscher/Downloads/E58639d_V2.30.1.pdf";
    var comparingPath = "C:/Users/AClavadetscher/Downloads/E58639c_V4.10.1.pdf";

    FileInputStream requestingStream = null;
    try {
      requestingStream = new FileInputStream(requestingPath);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
    FileInputStream comparingStream = null;
    try {
      comparingStream = new FileInputStream(comparingPath);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }

    try (Comparer comparer = new Comparer(requestingStream)) {
      comparer.add(comparingStream);
      byte[] resource;
      synchronized (CompareRestController.class) {
        try {
          final Path resultPath = comparer.compare(new FileOutputStream("C:/temp/OutputCompare.pdf"));
          System.out.println("Done");
        } catch (FileNotFoundException e) {
          e.printStackTrace();
        };
      }
    }
  }

I’m using the version 23.10 of groupdocs-comparison and its ran on windows.
Any solution for this Issue?

Best regards,
Aurelio Clavadetscher

@Auri321

Please share Java version, it’d be great if you could share a console application and problematic PDF files using that issue could be reproduced.

@Auri321

We couldn’t reproduce this issue at our end using both your code and this example.
Could you please share a simple console application using that issue could be reproduced?