You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2015/01/27 20:25:17 UTC
[19/37] olingo-odata2 git commit: [OLINGO-526] Fix for NPE in case
referenced attribute is missing
[OLINGO-526] Fix for NPE in case referenced attribute is missing
Signed-off-by: Chandan V A <ch...@sap.com>
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/e80f0199
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/e80f0199
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/e80f0199
Branch: refs/heads/Olingo-129_PocJpaDataStore
Commit: e80f0199f57cd8e0eabc30f82f5226a5f6a920d2
Parents: 88d2335
Author: Chandan V A <ch...@sap.com>
Authored: Fri Dec 26 10:36:42 2014 +0530
Committer: Chandan V A <ch...@sap.com>
Committed: Fri Dec 26 10:36:42 2014 +0530
----------------------------------------------------------------------
.../jpa/processor/api/exception/ODataJPAModelException.java | 2 ++
.../olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java | 4 ++++
.../jpa-core/src/main/resources/jpaprocessor_msg.properties | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/e80f0199/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAModelException.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAModelException.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAModelException.java
index 9f18f37..0ddb284 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAModelException.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAModelException.java
@@ -60,6 +60,8 @@ public class ODataJPAModelException extends ODataJPAException {
"INNER_EXCEPTION");
public static final MessageReference FUNC_PARAM_NAME_EXP = createMessageReference(ODataJPAModelException.class,
"FUNC_PARAM_NAME_EXP");
+ public static final MessageReference REF_ATTRIBUTE_NOT_FOUND = createMessageReference(ODataJPAModelException.class,
+ "REF_ATTRIBUTE_NOT_FOUND");
private ODataJPAModelException(final String localizedMessage, final Throwable e, final MessageReference msgRef) {
super(localizedMessage, e, msgRef);
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/e80f0199/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
index 9bce9fc..369f6b9 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
@@ -414,6 +414,10 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
}
}
+ if (currentRefAttribute == null) {
+ throw ODataJPAModelException.throwException(ODataJPAModelException.REF_ATTRIBUTE_NOT_FOUND
+ .addContent(referencedEntityType.getName()), null);
+ }
if (joinColumn.insertable() && joinColumn.updatable()) {
currentSimpleProperty = new SimpleProperty();
properties.add(buildSimpleProperty(currentRefAttribute, currentSimpleProperty, true));
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/e80f0199/odata2-jpa-processor/jpa-core/src/main/resources/jpaprocessor_msg.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/resources/jpaprocessor_msg.properties b/odata2-jpa-processor/jpa-core/src/main/resources/jpaprocessor_msg.properties
index 29c1006..7b4bb95 100644
--- a/odata2-jpa-processor/jpa-core/src/main/resources/jpaprocessor_msg.properties
+++ b/odata2-jpa-processor/jpa-core/src/main/resources/jpaprocessor_msg.properties
@@ -34,7 +34,7 @@ org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException.FUNC
org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException.FUNC_RETURN_TYPE_EXP="OData - JPA Model Processor: Return type expected. Class: [%1$s], Method: [%2$s]"
org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException.FUNC_RETURN_TYPE_ENTITY_NOT_FOUND="OData - JPA Model Processor: Return type not found. Class: [%1$s], Method: [%2$s], Type: [%3$s]"
org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException.FUNC_PARAM_NAME_EXP="OData - JPA Model Processor: Parameter Name for function import expected. Class: [%1$s]", Method: [%2$s]"
-
+org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException.REF_ATTRIBUTE_NOT_FOUND="OData - JPA Model Processor: Reference attribute not found in JPA entity [%1$s]"
#JPA Type converter Errors
org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException.TYPE_NOT_SUPPORTED="OData - JPA Type Converter: Type [%1$s] not supported"