Mantis - Resin
Viewing Issue Advanced Details
1817 minor always 06-22-07 08:58 07-26-07 14:55
ferg  
ferg  
normal  
closed 3.1.1  
fixed  
none    
none 3.1.3  
0001817: Hessian BigDecimal
(rep by Peter Henderson)


I am seeing an exception while using Hessian 3.1.1, Which I suspect is related to my client code using references.

Exception from my Hessian based Servlet.

java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.RangeCheck(ArrayList.java:547)
        at java.util.ArrayList.get(ArrayList.java:322)
        at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1500)
        at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:142)
        at com.caucho.hessian.server.HessianServlet.service(HessianServlet.java:361)
        at org.apache.catalina.core.ApplicationFilterChain.servletService (ApplicationFilterChain.java:398)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java :258)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:189)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
        at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:564)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:81)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:193)
        at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:611)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
        at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:611)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:255)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter (DefaultProcessorTask.java:618)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:549)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process (DefaultProcessorTask.java:790)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:326)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask (DefaultReadTask.java:248)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:199)
        at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java :348)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:93)


The client code looks like


        SupplierPart supplierPart = new SupplierPart();
        supplierPart.setComment1("c1");
        supplierPart.setComment2("c2");
        //supplierPart.setCompanyId(info.companyId );
        supplierPart.setConversionRate(BigDecimal.valueOf(1)); // BigDecimal.ONE);
        supplierPart.setDescription("Testing PO pending IN TX");
        supplierPart.setLeadTime(10);
        supplierPart.setMinOrderQty (BigDecimal.valueOf(2)); //BigDecimal.ONE);
        supplierPart.setPartId(info.poliPartId);
        //supplierPart.setPrice(19.23);
        //supplierPart.setPriceUpdatedOn(new java.util.Date());
        supplierPart.setSpecial (false);
        supplierPart.setStdReorderQty(BigDecimal.valueOf(10));
        supplierPart.setSupplierId(info.supplierId);
        supplierPart.setSupplierProductCode("Testing " + part.getPartNumber());
        supplierPart.setSupplierUnits("Each");
        supplierPart.setTaxCode("T1");
        
        List <SupplierPartPriceBreak> priceBreaks = new ArrayList<SupplierPartPriceBreak>();
        SupplierPartPriceBreak priceBreak = new SupplierPartPriceBreak();
        priceBreak.setPrice(BigDecimal.valueOf(19.23));
        priceBreak.setQty(BigDecimal.valueOf(1.2)); //BigDecimal.ONE);
        priceBreaks.add(priceBreak);

        // Call Hessian Service
        Integer supplierPartId = starjarEnterprise.createSuppliedPart(auth, supplierPart, priceBreaks);


To make the code work I've had to change all occurrences of BigDecimal.ONE to BigDecimal.valueof(x).
Without this change, the server side shows the above exception..


I am currently trying to reproduce this problem by using Hessian2Input and Hessian2Output to make a simple test case, with little progress so far.

My question, is this a bug in my code or a bug in hessian?

Notes
(0002143)
ferg   
07-26-07 14:55   
hessian/3b85