OPENJPA-485:

OPENJPA-497: Saving NPE

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@682570 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2008-08-05 03:19:13 +00:00
parent 49d5f19a68
commit b683569de0
2 changed files with 12 additions and 11 deletions

View File

@ -489,8 +489,10 @@ public class PCPath
for (; from != null && from != to;
from = from.getJoinablePCSuperclassMapping()) {
pstate.field = from.getFieldMapping(pstate.field
.getName());
FieldMapping cast = from.getFieldMapping(pstate.field
.getName());
if (cast != null)
pstate.field = cast;
pstate.joins = from.joinSuperclass(pstate.joins, false);
}
}

View File

@ -322,9 +322,8 @@ public class QueryImpl implements OpenJPAQuerySPI, Serializable {
if (expectedParamType.isPrimitive() && actualValue == null)
newValidationException("param-type-null",
position, query, expectedParamType.getName());
if (actualValue == null)
continue;
if (!Filters.wrap(expectedParamType).isInstance(actualValue))
if (actualValue != null &&
!Filters.wrap(expectedParamType).isInstance(actualValue))
newValidationException("param-type-mismatch",
position, query, actualValue,
actualValue.getClass().getName(),
@ -347,8 +346,8 @@ public class QueryImpl implements OpenJPAQuerySPI, Serializable {
if (expectedParamType.isPrimitive() && actualValue == null)
newValidationException("param-type-null",
position, query, expectedParamType.getName());
if (!Filters.wrap(expectedParamType)
.isInstance(actualValue))
if (actualValue != null
&& !Filters.wrap(expectedParamType).isInstance(actualValue))
newValidationException("param-type-mismatch",
position, query, actualValue,
actualValue.getClass().getName(),
@ -375,9 +374,8 @@ public class QueryImpl implements OpenJPAQuerySPI, Serializable {
if (expectedParamType.isPrimitive() && actualValue == null)
newValidationException("param-type-null",
expectedName, query, expectedParamType.getName());
if (actualValue == null)
continue;
if (!Filters.wrap(expectedParamType).isInstance(actualValue)) {
if (actualValue != null
&& !Filters.wrap(expectedParamType).isInstance(actualValue)) {
newValidationException("param-type-mismatch",
expectedName, query, actualValue,
actualValue.getClass().getName(),
@ -395,7 +393,8 @@ public class QueryImpl implements OpenJPAQuerySPI, Serializable {
if (expectedParamType.isPrimitive() && actualValue == null)
newValidationException("param-type-null",
actualName, query, expectedParamType.getName());
if (!Filters.wrap(expectedParamType).isInstance(actualValue)) {
if (actualValue != null
&& !Filters.wrap(expectedParamType).isInstance(actualValue)) {
newValidationException("param-type-mismatch",
actualName, query, actualValue,
actualValue.getClass().getName(),