openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Han Hong Fang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-1992) java.lang.ArrayIndexOutOfBoundsException if positional parameter are not started from 1
Date Fri, 06 May 2011 06:24:03 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-1992?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13029773#comment-13029773
] 

Han Hong Fang commented on OPENJPA-1992:
----------------------------------------

Hi Michael,

This exception can be reproduced with the hellojpa sample by following Getting Started with
the Eclipse steps on http://openjpa.apache.org/getting-started.html. After step 10, replace
the Main.java with the attached copy of Main.java, and then rerun step 9.

I noticed that spec indicates that input parameters will start with 1 in both JPA spec(section
4.6.4.1) and EJB spec(section 9.2.6.4), but this exception blocks our TCK, which expects "SELECT
x FROM Magazine x WHERE x.title = ?2 and x.price > ?3" can be successfully processed.

> java.lang.ArrayIndexOutOfBoundsException if positional parameter are not started from
1
> ---------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1992
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1992
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.1.0
>            Reporter: Han Hong Fang
>            Assignee: Michael Dick
>         Attachments: Main.java, OPENJPA-1992.patch
>
>
> Query q = em.createQuery("SELECT x FROM Magazine x WHERE x.title = ?2 and x.price >
?3");
> q.setParameter(2, "JDJ").setParameter(3, 25.0);
> When the query is executed, java.lang.ArrayIndexOutOfBoundsException will be thrown.
Since "JDJ" and "25.0" will be stored in arr[0] and arr[1] (when arr.size =2) but the query
execution code tries to get them via arr[2] and arr[3].

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message