Hello All,

Similar problem occurred while creating Product Promo, when we upload file
for Promo Code Emails then  ERROR: java.lang.ClassCastException:
java.nio.HeapByteBuffer occurs.
This file contains list of EmailIds.

This error can be resolved by using following code snippet in file
"PromoServices.java" and function 'importPromoCodeEmailsFromFile".
Promo Code Emails
Reason of error :  byte[] wrapper = (byte[]) context.get("uploadedFile");
(Line number : 239)

This line can be replaced by :
ByteBuffer bytebufferwrapper = (ByteBuffer) context.get("uploadedFile");
    
        if (bytebufferwrapper == null) {
            return
ServiceUtil.returnError(UtilProperties.getMessage(resource, 
                    "ProductPromoCodeImportUploadedFileNotValid", locale));
        }

        byte[] wrapper =  bytebufferwrapper.array();


Hope , then this error will not occur and file can be uploaded successfully.

Please revert back in case anything wrong or missing.

Regards
Nandani 

--
View this message in context: 
http://ofbiz.135035.n4.nabble.com/Upload-CSV-throws-java-lang-ClassCastException-java-nio-HeapByteBuffe-tp155781p4632767.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to