openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Heath Thomann (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (OPENJPA-2118) Prepared SQL query does not handle collection-valued parameter where collection is empty
Date Thu, 31 May 2012 01:49:22 GMT

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

Heath Thomann resolved OPENJPA-2118.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.1
                   2.3.0
                   2.1.2
                   2.0.2
    
> Prepared SQL query does not handle collection-valued parameter where collection is empty
> ----------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2118
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2118
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 2.0.0, 2.1.0, 2.2.0
>            Reporter: Heath Thomann
>            Assignee: Heath Thomann
>             Fix For: 2.0.2, 2.1.2, 2.3.0, 2.2.1
>
>
> In PreparedQueryImpl.setCollectionValuedParameter, we do a '%n' but don't check for n==0,
as can be seen here:
>     private void setCollectionValuedParameter(Map<Integer,Object> result, 
>         Collection values, int[] indices, Object param) {
>         int n = values.size();
>         Object[] array = values.toArray();
>         if (n > indices.length || indices.length%n != 0) {    <---------------------line
389 in 2.0.x
> When n==0, the following exception will occur:
> Exception data: java.lang.ArithmeticException: divide by zero
>         at org.apache.openjpa.jdbc.kernel.PreparedQueryImpl.setCollectionValuedParameter(PreparedQueryImpl.java:389)
> I will upload a test to reproduce this issue and a proposed fix in the next day or two.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message