Avoid potential NPE; fix error msg.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@590143 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Patrick Linskey 2007-10-30 16:51:32 +00:00
parent cd2f9e978e
commit 73b35874f0
1 changed files with 8 additions and 6 deletions

View File

@ -463,10 +463,11 @@ public class StateManagerImpl
// merge the fetchgroup required fields to the original
// fields only the fields are not already loaded and
// are not in the original fields.
for (int j = 0; j < fgFields.length(); j++) {
if (fgFields.get(j) && !fields.get(j) && !_loaded.get(j))
fields.set(j);
}
if (fgFields != null)
for (int j = 0; j < fgFields.length(); j++) {
if (fgFields.get(j) && !fields.get(j) &&!_loaded.get(j))
fields.set(j);
}
}
}
@ -597,7 +598,7 @@ public class StateManagerImpl
// Just return if there's no value generation strategy
if (fmd.getValueStrategy() == ValueStrategies.NONE)
return false;
// Throw exception if field already has a value assigned.
// @GeneratedValue overrides POJO initial values and setter methods
if (!isDefaultValue(field) && !fmd.isValueGenerated())
@ -816,7 +817,8 @@ public class StateManagerImpl
SaveFieldManager saved = getSaveFieldManager();
if (saved == null)
throw new InternalException(_loc.get("no-saved-fields"));
throw new InternalException(_loc.get("no-saved-fields",
getManagedInstance()));
FieldMetaData[] fmds = getMetaData().getFields();
for (int i = 0; i < fmds.length; i++) {