Repository: olingo-odata4
Updated Branches:
  refs/heads/master ebf4eb928 -> bde34e597


[OLINGO-964] fix proposal for cast type not taken into account while expanding 
a collection

Signed-off-by: Christian Amend <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/8a10f47b
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/8a10f47b
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/8a10f47b

Branch: refs/heads/master
Commit: 8a10f47b8955f7c4b60b8f3bdcdc8fbf5240199d
Parents: ebf4eb9
Author: Jacek Milaczewski <[email protected]>
Authored: Mon May 30 09:46:38 2016 +0200
Committer: Christian Amend <[email protected]>
Committed: Thu Jul 28 14:53:11 2016 +0200

----------------------------------------------------------------------
 .../apache/olingo/server/core/uri/parser/ExpandParser.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8a10f47b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ExpandParser.java
----------------------------------------------------------------------
diff --git 
a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ExpandParser.java
 
b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ExpandParser.java
index 1da143a..8a493ff 100644
--- 
a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ExpandParser.java
+++ 
b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ExpandParser.java
@@ -136,13 +136,13 @@ public class ExpandParser {
       UriResourcePartTyped lastPart = (UriResourcePartTyped) 
resource.getLastResourcePart();
 
       boolean hasSlash = false;
+      EdmStructuredType typeCastSuffix = null;
       if (tokenizer.next(TokenKind.SLASH)) {
         hasSlash = true;
         if (lastPart instanceof UriResourceNavigation) {
           UriResourceNavigationPropertyImpl navigationResource = 
(UriResourceNavigationPropertyImpl) lastPart;
           final EdmNavigationProperty navigationProperty = 
navigationResource.getProperty();
-          final EdmStructuredType typeCastSuffix = 
ParserHelper.parseTypeCast(tokenizer, edm,
-              navigationProperty.getType());
+          typeCastSuffix = ParserHelper.parseTypeCast(tokenizer, edm, 
navigationProperty.getType());
           if (typeCastSuffix != null) {
             if (navigationProperty.isCollection()) {
               navigationResource.setCollectionTypeFilter(typeCastSuffix);
@@ -154,7 +154,8 @@ public class ExpandParser {
         }
       }
 
-      final EdmStructuredType newReferencedType = (EdmStructuredType) 
lastPart.getType();
+      final EdmStructuredType newReferencedType = typeCastSuffix != null ? 
typeCastSuffix 
+        : (EdmStructuredType) lastPart.getType();
       final boolean newReferencedIsCollection = lastPart.isCollection();
       if (hasSlash || tokenizer.next(TokenKind.SLASH)) {
         if (tokenizer.next(TokenKind.REF)) {

Reply via email to