You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2012/06/02 12:17:19 UTC

Re: Upload CSV throws java.lang.ClassCastException: java.nio.HeapByteBuffe

Sounds good, but you should rather contribute following 
https://cwiki.apache.org/confluence/display/OFBADMIN/OFBiz+Contributors+Best+Practices
Explain there what you tried to do (with steps and elements) and what happened. And attach a patch

It will be then easier to us (commiters) to review and test and if correct to commit in trunk and maybe releases branches

Thanks

Jacques

From: "Nandani" <na...@paxcel.net>
> 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. 

Re: Upload CSV throws java.lang.ClassCastException: java.nio.HeapByteBuffe

Posted by Nandani <na...@paxcel.net>.
Hello Jacques ,

Thanks for your precious Guidance.I have created Jira Issue :
OFBIZ-4919<https://issues.apache.org/jira/browse/OFBIZ-4919> and
have attached screenshot and required Patch.

Regards
Nandani Aggarwal.

On Sat, Jun 2, 2012 at 3:48 PM, Jacques Le Roux [via OFBiz] <
ml-node+s135035n4633018h71@n4.nabble.com> wrote:

> Sounds good, but you should rather contribute following
>
> https://cwiki.apache.org/confluence/display/OFBADMIN/OFBiz+Contributors+Best+Practices
> Explain there what you tried to do (with steps and elements) and what
> happened. And attach a patch
>
> It will be then easier to us (commiters) to review and test and if correct
> to commit in trunk and maybe releases branches
>
> Thanks
>
> Jacques
>
> From: "Nandani" <[hidden email]<http://user/SendEmail.jtp?type=node&node=4633018&i=0>>
>
>
> > 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.
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://ofbiz.135035.n4.nabble.com/Upload-CSV-throws-java-lang-ClassCastException-java-nio-HeapByteBuffe-tp155781p4633018.html
>  To unsubscribe from Upload CSV throws java.lang.ClassCastException:
> java.nio.HeapByteBuffe, click here<http://ofbiz.135035.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=155781&code=bmFuZGFuaS5hZ2dhcndhbEBwYXhjZWwubmV0fDE1NTc4MXwtMTg1ODgzODE1NQ==>
> .
> NAML<http://ofbiz.135035.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


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