OPENJPA-2472: Fix concurrency bug in ClassMetaData. Patch contributed by Dalia Abo Sheasha.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1564989 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Richard G. Curtis 2014-02-05 23:12:37 +00:00
parent e21bcdfaa9
commit 731649a2c9

View File

@ -2692,19 +2692,20 @@ public class ClassMetaData
// Default to false, set to true only if this type is abstract and
// declares a PKField.
_hasAbstractPKField = Boolean.FALSE;
Boolean temp = Boolean.FALSE;
if (isAbstract() == true) {
FieldMetaData[] declaredFields = getDeclaredFields();
if (declaredFields != null && declaredFields.length != 0) {
for (FieldMetaData fmd : declaredFields) {
if (fmd.isPrimaryKey()) {
_hasAbstractPKField = Boolean.TRUE;
temp = Boolean.TRUE;
break;
}
}
}
}
_hasAbstractPKField = temp;
return _hasAbstractPKField.booleanValue();
}
@ -2726,7 +2727,7 @@ public class ClassMetaData
}
// Default to FALSE, until proven true.
_hasPKFieldsFromAbstractClass = Boolean.FALSE;
Boolean temp = Boolean.FALSE;
FieldMetaData[] pkFields = getPrimaryKeyFields();
for (FieldMetaData fmd : pkFields) {
@ -2741,11 +2742,12 @@ public class ClassMetaData
}
}
if (cmd == fmdDMDA) {
_hasPKFieldsFromAbstractClass = Boolean.TRUE;
temp = Boolean.TRUE;
break;
}
}
}
_hasPKFieldsFromAbstractClass = temp;
return _hasPKFieldsFromAbstractClass.booleanValue();
}
@ -2783,10 +2785,11 @@ public class ClassMetaData
}
}
int idsSize = ids.size();
_pkAndNonPersistentManagedFmdIndexes = new int[idsSize];
for(int i = 0; i<idsSize; i++){
_pkAndNonPersistentManagedFmdIndexes[i] = ids.get(i).intValue();
int[] temp = new int[idsSize];
for (int i = 0; i < idsSize; i++) {
temp[i] = ids.get(i).intValue();
}
_pkAndNonPersistentManagedFmdIndexes = temp;
}
return _pkAndNonPersistentManagedFmdIndexes;
}