Fixes are available
8.5.0.1: WebSphere Application Server V8.5 Fix Pack 1
8.0.0.5: WebSphere Application Server V8.0 Fix Pack 5
8.5.0.2: WebSphere Application Server V8.5 Fix Pack 2
8.0.0.6: WebSphere Application Server V8.0 Fix Pack 6
8.0.0.7: WebSphere Application Server V8.0 Fix Pack 7
8.0.0.8: WebSphere Application Server V8.0 Fix Pack 8
8.0.0.9: WebSphere Application Server V8.0 Fix Pack 9
8.0.0.10: WebSphere Application Server V8.0 Fix Pack 10
8.0.0.11: WebSphere Application Server V8.0 Fix Pack 11
8.0.0.12: WebSphere Application Server V8.0 Fix Pack 12
8.0.0.13: WebSphere Application Server V8.0 Fix Pack 13
8.0.0.14: WebSphere Application Server V8.0 Fix Pack 14
8.0.0.15: WebSphere Application Server V8.0 Fix Pack 15
APAR status
Closed as program error.
Error description
https://issues.apache.org/jira/browse/OPENJPA-2118 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.setCollectionVa luedParameter(PreparedQueryImpl.java:389)
Local fix
n/a
Problem summary
**************************************************************** * USERS AFFECTED: All users of IBM WebSphere Application * * Server V8.0.0 and V8.5.0 who make * * use of quries which contain an empty * * collection. * **************************************************************** * PROBLEM DESCRIPTION: OpenJPA Prepared SQL query does not * * handle collection-valued parameter * * where collection is empty. * **************************************************************** * RECOMMENDATION: * **************************************************************** When using a Prepared SQL query, there exists the potential for a 'java.lang.ArithmeticException: divide by zero' exception. This occurs when the a collection-valued parameter is used in the SQL. For example, take the following SQL: String jpql = "select e from Employee e where e.department in :param"; where Employee and Department are in a relationship, as follows: public class Employee { @Id @GeneratedValue private long id; @ManyToOne private Department department; ...... public class Department { @Id @GeneratedValue private long id; @OneToMany private Collection<Employee> employees = new HashSet<Employee>(); ...... Given these two entities, and the above query, the following execution will result in the exception: // Pass an empty list to 'param'. em.createQuery(jpql).setParameter("param", new ArrayList<Department>()).getResultList();
Problem conclusion
With this fix, code has been added to guard against a division by zero exception in the scenario described. That is, the area of code which causes the division by zero will add a check for a zero before performing a division. The fix for this APAR is currently targeted for inclusion in Service Levels (Fix Packs) 8.0.0.5 and 8.5.0.1 of WebSphere Application Server versions 8.0.0 and 8.5.0. Please refer to the recommended updates page for delivery information: http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
Temporary fix
Comments
APAR Information
APAR number
PM64809
Reported component name
WEBSPHERE APP S
Reported component ID
5724J0800
Reported release
800
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2012-05-16
Closed date
2012-07-09
Last modified date
2012-09-21
APAR is sysrouted FROM one or more of the following:
PM59928
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
WEBSPHERE APP S
Fixed component ID
5724J0800
Applicable component levels
R800 PSY
UP
R850 PSY
UP
Document Information
Modified date:
28 October 2021