[ 
https://issues.apache.org/jira/browse/OPENJPA-1992?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Dick resolved OPENJPA-1992.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.0

While in theory we could support positional parameters that do not start with 
1, or contain gaps I don't think there's a compelling reason to add such 
support. 

We should not throw an ArrayIndexOutOfBoundsException during query execution 
though. I've checked in changes that will detect the condition when the query 
is created and throw a UserException that explains why the query string is bad.

> 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
>             Fix For: 2.2.0
>
>         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

Reply via email to