Community
Participate
Working Groups
Caused by an obvious oversight (really a typo): public List<Class> getPrimaryKeyClassifications() { if (primaryKeyClassifications == null) { List primaryKeyFields = this.descriptor.getPrimaryKeyFields(); List<Class> classifications = new ArrayList(primaryKeyFields.size()); for (int index = 0; index < primaryKeyFields.size(); index++) { DatabaseMapping mapping = getPrimaryKeyMappings().get(index); DatabaseField field = (DatabaseField)primaryKeyFields.get(index); if (mapping != null) { classifications.add(Helper.getObjectClass(mapping.getFieldClassification(field))); } else { classifications.add(null); } primaryKeyClassifications = classifications; } } return primaryKeyClassifications; } Assignment to primaryKeyClassifications done inside the loop causes it to be possibly altered by thread 2 while thread 1 is working on it - that causes IndexOutOfBounds exception. Of course the assignment should be done outside of the loop: public List<Class> getPrimaryKeyClassifications() { if (primaryKeyClassifications == null) { List primaryKeyFields = this.descriptor.getPrimaryKeyFields(); List<Class> classifications = new ArrayList(primaryKeyFields.size()); for (int index = 0; index < primaryKeyFields.size(); index++) { DatabaseMapping mapping = getPrimaryKeyMappings().get(index); DatabaseField field = (DatabaseField)primaryKeyFields.get(index); if (mapping != null) { classifications.add(Helper.getObjectClass(mapping.getFieldClassification(field))); } else { classifications.add(null); } } primaryKeyClassifications = classifications; } return primaryKeyClassifications; }
Checked the patch into trunk, 2.1.2 is pending.
Checked the patch into 2.1.2.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink