olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [48/50] [abbrv] git commit: [OLINGO-409] Fix NPE in $expand call
Date Tue, 02 Sep 2014 11:50:08 GMT
[OLINGO-409] Fix NPE in $expand call

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

Branch: refs/heads/Olingo-129_PocJpaDataStore
Commit: 78f31a8e6cf5cb1db1600ad400d4259ea0f0cb8a
Parents: 7092ad3
Author: Chandan V A <chandan.v.a@sap.com>
Authored: Sun Aug 31 08:44:47 2014 +0530
Committer: Chandan V A <chandan.v.a@sap.com>
Committed: Sun Aug 31 08:44:47 2014 +0530

----------------------------------------------------------------------
 .../odata2/jpa/processor/core/access/data/JPAEntityParser.java  | 3 +++
 .../odata2/jpa/processor/core/access/data/JPAProcessorImpl.java | 5 +++--
 .../odata2/jpa/processor/core/callback/JPAExpandCallBack.java   | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/78f31a8e/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java
index 9543bfe..318d05e 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java
@@ -163,6 +163,9 @@ public final class JPAEntityParser {
     Object result = null;
     String methodName = null;
     HashMap<String, Object> navigationMap = new HashMap<String, Object>();
+    if (jpaEntity == null) {
+      return navigationMap;
+    }
     if (navigationPropertyList != null
         && navigationPropertyList.size() != 0) {
 

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/78f31a8e/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java
index e7f041b..8c497d3 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java
@@ -131,8 +131,9 @@ public class JPAProcessorImpl implements JPAProcessor {
       return (List<Object>) process((GetFunctionImportUriInfo) uriParserResultView);
     }
     InlineCount inlineCount = uriParserResultView.getInlineCount();
-    Integer top = uriParserResultView.getTop();
-    if (top != null && top.intValue() == 0 && inlineCount != null &&
inlineCount.equals(InlineCount.ALLPAGES)) {
+    Integer top = uriParserResultView.getTop() == null ? 1 : uriParserResultView.getTop().intValue();
+    boolean hasNoAllPages = inlineCount == null ? true : !inlineCount.equals(InlineCount.ALLPAGES);
+    if (top.intValue() == 0 && hasNoAllPages) {
       return new ArrayList<Object>();
     }
     JPQLContextType contextType = null;

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/78f31a8e/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/callback/JPAExpandCallBack.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/callback/JPAExpandCallBack.java
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/callback/JPAExpandCallBack.java
index 19bcf77..41cad61 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/callback/JPAExpandCallBack.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/callback/JPAExpandCallBack.java
@@ -87,7 +87,9 @@ public class JPAExpandCallBack implements OnWriteFeedContent, OnWriteEntryConten
         }
         HashMap<String, Object> navigationMap =
             jpaResultParser.parse2EdmNavigationValueMap(inlinedEntry, currentNavPropertyList);
-        edmPropertyValueMap.putAll(navigationMap);
+        if (edmPropertyValueMap != null) {
+          edmPropertyValueMap.putAll(navigationMap);
+        }
         result.setEntryData(edmPropertyValueMap);
       }
       result.setInlineProperties(getInlineEntityProviderProperties(context));


Mime
View raw message