persistence@glassfish.java.net

Re: glassfish bug 1624

From: Tom Ware <tom.ware_at_oracle.com>
Date: Mon, 12 Mar 2007 10:47:57 -0400

Hi Wonseok,

  Go ahead and check-in the fix.

-Tom

Wonseok Kim wrote:

> Hi, Tom
>
> I received a patch for this from ASM team.
> Local test has shown that this problem is gone, so I patched it to
> bundled ASM code and added a testcase.
> Please review below diff.
>
> -Wonseok
>
> Index: Annotation.java
> ===================================================================
> RCS file:
> /cvs/glassfish/entity-persistence/src/java/oracle/toplink/libraries/asm/attrs/Annotation.java,v
> retrieving revision 1.2
> diff -c -r1.2 Annotation.java
> *** Annotation.java 2 Mar 2006 20:51:13 -0000 1.2
> --- Annotation.java 10 Mar 2007 14:58:33 -0000
> ***************
> *** 454,459 ****
> --- 454,463 ----
> case '[': // array_value
> int size = cr.readUnsignedShort(off[0]);
> off[0] += 2;
> +
> + //PATCH for GF#1624 (From ASM Team) - handle empty
> annotation array value
> + if(size==0) return new Object[0];
> +
> int childTag = cr.readByte( off[ 0]);
> switch( childTag) {
> case 'I': // pointer to CONSTANT_Integer
> Index: Order.java
> ===================================================================
> RCS file:
> /cvs/glassfish/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/models/cmp3/relationships/Order.java,v
> retrieving revision 1.5
> diff -c -r1.5 Order.java
> *** Order.java 4 Jan 2007 14:30:21 -0000 1.5
> --- Order.java 10 Mar 2007 14:59:03 -0000
> ***************
> *** 32,37 ****
> --- 32,38 ----
> name="findAllOrdersByItem",
> query="SELECT OBJECT(theorder) FROM OrderBean theorder WHERE
> theorder.item.itemId = :id"
> )
> + @NamedNativeQueries({/*empty*/}) //Test for GF#1624 - Weaving failed
> if there is empty annotation array value
> public class Order implements java.io.Serializable {
> private Integer orderId;
> private int version;
>
>
> On 3/10/07, *Tom Ware* <tom.ware_at_oracle.com
> <mailto:tom.ware_at_oracle.com>> wrote:
>
> Hi Wonseok,
>
> I agree, lets wait on the ASM experts to see what they say.
>
> Your change looks good.
>
> -Tom
>
> Wonseok Kim wrote:
>
> > Hi Peter,
> >
> > My investigation have shown that ASM throws exception if there is
> > empty annotation array values like @Table(uniqueConstraints = {})
> > I'm not ASM expert, so I sent a email to * asm_at_objectweb.org
> <mailto:asm_at_objectweb.org>
> > <mailto: asm_at_objectweb.org <mailto:asm_at_objectweb.org>> *mailing
> list to inquire about this.
> >
> http://www.nabble.com/ASM-1.5.3-ArrayIndexOutOfBoundsException-is-thrown-if-there-is-empty-annotation-array-values-tf3374118.html
> <http://www.nabble.com/ASM-1.5.3-ArrayIndexOutOfBoundsException-is-thrown-if-there-is-empty-annotation-array-values-tf3374118.html>
> >
> > In our side we should log the exception thrown from ASM,
> otherwise it
> > is not easy to find the root cause for this kind of problem.
> > Hence, I added some logging code as the attached fix.
> >
> > Tom, could you review this? I will check in this first if you agree.
> >
> > To fix this issue completely, ASM code should be modified. ASM
> > 3.0(2.0, too) has a fix for this, but ASM 1.5.3 has not. As you
> know,
> > ASM 3.0 is the latest version, but it is not compatible with ASM
> > 1.5.3. So it's not trivial issue to switch into ASM 3.0.
> > For the moment, let's wait the response from ASM experts to see
> if we
> > can patch the bundled ASM 1.5.3.
> >
> > Thanks
> > -Wonseok
> >
> > On 3/9/07, *Peter Krogh* <peter.krogh_at_oracle.com
> <mailto:peter.krogh_at_oracle.com>
> > <mailto: peter.krogh_at_oracle.com
> <mailto:peter.krogh_at_oracle.com>>> wrote:
> >
> > You posted to this bug that it there is an ASM
> error... Have you
> > dug any deeper, or were you planning to dig deeper? ;)
> >
> >
>
>

-- 
Tom Ware
Principal Software Engineer
Oracle Canada Inc.
Direct: (613) 783-4598
Email: tom.ware_at_oracle.com