I got the following exception when calling method AsposeOCR.RecognizePage on a specific image.
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
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:266)
at java.base/java.util.Objects.checkIndex(Objects.java:361)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at com.aspose.ocr.e0cd0c2d77.c0ad(Unknown Source)
at com.aspose.ocr.e0cd0c5d77.e0cd0c6d16(Unknown Source)
at com.aspose.ocr.e0cd0c5d77.ac8a(Unknown Source)
at com.aspose.ocr.e0cd0c5d77.f(Unknown Source)
at com.aspose.ocr.AsposeOCR.RecognizePage(Unknown Source)
The error occurs for this particular image only. I am on version 22.5. I tried the image on version 23.11.0 and got the same error. I also tried the image on the Aspose OCR demo page and got some error as well. The image is attached below.
34-work area.jpg (6.4 KB)
Here is the Java code.
RecognitionSettings settings = new RecognitionSettings();
settings.setLanguage(Language.Chi);
RecognitionResult recognized = new AsposeOCR().RecognizePage(bufferedImage, settings);
Commenting out the lcall to setLanguage prevents the error. But that is not an option for me as auto language does not work well for Chinese.