You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2014/06/15 11:59:34 UTC

git commit: [OLINGO-312] Fix NULL Pointer Exception

Repository: olingo-odata2
Updated Branches:
  refs/heads/master 41d99109b -> 93590ee5c


[OLINGO-312] Fix NULL Pointer Exception

Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/93590ee5
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/93590ee5
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/93590ee5

Branch: refs/heads/master
Commit: 93590ee5cff60d87b8eefbcdc54c79272cc1c259
Parents: 41d9910
Author: Chandan V A <ch...@sap.com>
Authored: Sun Jun 15 15:29:29 2014 +0530
Committer: Chandan V A <ch...@sap.com>
Committed: Sun Jun 15 15:29:29 2014 +0530

----------------------------------------------------------------------
 .../core/access/model/JPAEdmMappingModelService.java   | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/93590ee5/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java
index 4b5d396..8bec453 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java
@@ -27,6 +27,7 @@ import javax.xml.bind.Unmarshaller;
 import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
 import org.apache.olingo.odata2.jpa.processor.api.access.JPAEdmMappingModelAccess;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
+import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmExtension;
 import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAAttributeMapType.JPAAttribute;
 import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAEdmMappingModel;
 import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAEmbeddableTypeMapType;
@@ -42,8 +43,16 @@ public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {
   private String mappingModelName;
 
   public JPAEdmMappingModelService(final ODataJPAContext ctx) {
-    mappingModelExists = (mappingModelName = ctx.getJPAEdmMappingModel()) == null ?
-        (((mappingModelStream = ctx.getJPAEdmExtension().getJPAEdmMappingModelStream()) == null) ? false : true) : true;
+    JPAEdmExtension ext = null;
+    mappingModelName = ctx.getJPAEdmMappingModel();
+    if (mappingModelName == null) {
+      ext = ctx.getJPAEdmExtension();
+      if (ext != null) {
+        mappingModelStream = ext.getJPAEdmMappingModelStream();
+      }
+    }
+
+    mappingModelExists = mappingModelName != null || mappingModelStream != null ? true : false;
   }
 
   @Override