OOM while reading barcodes

We have been using Aspose.Barcode java library to read barcodes in a document. However, on certain files, the component goes OOM. In my case, the document was ~3MB and the JVM was 4GB. Can you please assist.

Tried with the below versions and both have the same issue-
aspose-barcode-17.8.jar
aspose-barcode-16.12.jar

I do not see an option to attach files here. Let me know how can I provide you with the sample code and test document.

@pranayr,

Thank you for sharing details. You may use the “Upload” option available in the tool bar to send us the sample input file as a reply to this post.

hi Ikram, The upload utility is not allowing me to upload .tiff file

Adding .jpg to the file extension. Please remove the .jpg extension and use the .tiff file to test. Sample code below -

import java.io.IOException;

import com.aspose.barcode.barcoderecognition.BarCodeReader;
import com.aspose.pdf.Document;
import com.aspose.pdf.License;

public class ProdIsBarcodedTest {

public static void main(String[] args) throws Exception {

    License lic = new License();
    lic.setLicense("Aspose.Total.Java.lic");

    com.aspose.barcode.License licBarcode = new com.aspose.barcode.License();
    licBarcode.setLicense("Aspose.Total.Java.lic");

    boolean isBarcoded = isBarcodedTiff("problematic_file.tiff");
    System.out.println(isBarcoded);
}

public static boolean isBarcodedTiff(String filePath) {
    BarCodeReader reader = null;
    try {
        String fileName = filePath;
        reader = new BarCodeReader(fileName);
        boolean read = reader.read();

        if (read && reader.getReadTypeName().equals("Pdf417")) {
            System.out.println("Found PDF417 barcodes in file : " + fileName);
            return true;
        }
    } finally {
        if (reader != null)
            reader.close();
    }
    return false;
}

}
problematic_file.tiff.jpg (729.3 KB)

@pranayr,

We have evaluated the sample provided by you. We are unable able to reproduce the issue. Please verify that you have shared the correct input file because the file shared by you is of 760KB whereas you had mentioned it is 3MB. In case the uploaded file is not the correct one then please zip the file and share it again.

UPload issues.JPG (17.1 KB)

I tried uploading the zip file, but for the attached error.
“Sorry, the file you are trying to upload is too big (maximum size is 3072KB)”

Is there an alternative way to provide you with the file.

@pranayr,

You may please use dropbox or Google drive to upload and share the link with us to download it.

hi Ikram,

can you access https://drive.google.com/folderview?id=0B8s7UL8JOzTDNXpoRlFBaXFiQ2s

@pranayr,

We have evaluated the sample TIFF image. Initial investigation shows that the issue persists. The issue has been logged into our system with ID BARCODEJAVA-385 for further investigation. We’ll update you here once there is some information or a fix version available in this regard.

Thanks Ikram.

Is there a tentative timeline for this issue to be fixed ? This issue has been occurring frequently in our environment.

@pranayr,

The issue is currently in the queue for further investigation. However we have asked our product team provide feedback on this issue. We will update you in this forum thread as soon as any update or information is available.

hi Ikram,
Is there an update on this?

thanks

@pranayr,

This is to update you that our product team is working on this issue. The tentative time for the fix to be available is in our monthly release next month. As soon as the fix will be available, you will be updated in this forum thread.

hi Ikram,
When is release of Aspose.BarCode for Java 17.11 scheduled? Will fix for this issue be part of this release?

thank you.

@pranayr,

The Aspose.BarCode for Java 17.11 will be released soon but no specific date has been announced. The resolution of this issue depends on an other issue and our product team is working on fixing that issue.

hi Ikram,

Is there an update on this? It has been lying around for quite some time now.

thanks
pranay

@pranayr,

This is to update you that our product team is working on this issue. We are facing some buffer overflow issues while fixing this. As soon as it is fixed, we will update you here in this forum thread. We are sorry for the inconvenience.

@pranayr,

The issue (BARCODEJAVA-385) has been fixed. Please download the latest version of Aspose.BarCode for Java and try it at your end.

Hi Ikram,

Can you give working piece of code with latest version for PDF417 barcode type.

@jharos,

You may use the following code snippet to read the barcode.

CODE:

com.aspose.barcode.barcoderecognition.BarCodeReader reader = new com.aspose.barcode.barcoderecognition.BarCodeReader("problematic_file.tiff");

// You may also use the following line of code
// com.aspose.barcode.barcoderecognition.BarCodeReader reader = 
            new com.aspose.barcode.barcoderecognition.BarCodeReader("problematic_file.tiff", com.aspose.barcode.barcoderecognition.DecodeType.PDF_417);

int iCount = 0;

while (reader.read())
{
    System.out.println(" codetext: " + reader.getCodeText());
    iCount = iCount + 1;
}
System.out.println("Total barcode found  : " + iCount);