You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pp...@apache.org on 2008/08/05 05:19:13 UTC
svn commit: r682570 - in /openjpa/trunk:
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java
openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
Author: ppoddar
Date: Mon Aug 4 20:19:13 2008
New Revision: 682570
URL: http://svn.apache.org/viewvc?rev=682570&view=rev
Log:
OPENJPA-485:
OPENJPA-497: Saving NPE
Modified:
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java
openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java?rev=682570&r1=682569&r2=682570&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java Mon Aug 4 20:19:13 2008
@@ -489,8 +489,10 @@
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);
}
}
Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java?rev=682570&r1=682569&r2=682570&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java Mon Aug 4 20:19:13 2008
@@ -322,9 +322,8 @@
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 @@
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 @@
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 @@
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(),