olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject olingo-odata2 git commit: [OLINGO-1146] Fix regression for filter with navigation
Date Sat, 23 Sep 2017 13:26:48 GMT
Repository: olingo-odata2
Updated Branches:
  refs/heads/OLINGO-1146-Fix [created] 00586891a


[OLINGO-1146] Fix regression for filter with navigation


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

Branch: refs/heads/OLINGO-1146-Fix
Commit: 00586891af417be3052cbc8808ef2201350ea6d3
Parents: 2c56059
Author: mibo <mibo@apache.org>
Authored: Sat Sep 23 15:25:52 2017 +0200
Committer: mibo <mibo@apache.org>
Committed: Sat Sep 23 15:25:52 2017 +0200

----------------------------------------------------------------------
 .../core/uri/expression/FilterParserImpl.java      | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/00586891/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java
b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java
index bf16e24..709f284 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java
@@ -506,11 +506,13 @@ public class FilterParserImpl implements FilterParser {
       if (edmProperty != null) {
         property.setEdmProperty(edmProperty);
         property.setEdmType(edmProperty.getType());
-        if (edmProperty.getMultiplicity() == EdmMultiplicity.MANY) {
-          throw new ExpressionParserException(
-              ExpressionParserException.INVALID_MULTIPLICITY.create()
-                  .addContent(propertyName)
-                  .addContent(propertyToken.getPosition() + 1));
+        if(isLastFilterElement(propertyName)) {
+          if (edmProperty.getMultiplicity() == EdmMultiplicity.MANY) {
+            throw new ExpressionParserException(
+                ExpressionParserException.INVALID_MULTIPLICITY.create()
+                    .addContent(propertyName)
+                    .addContent(propertyToken.getPosition() + 1));
+          }
         }
       } else {
         // Tested with TestParserExceptions.TestPMvalidateEdmProperty CASE 3
@@ -524,6 +526,11 @@ public class FilterParserImpl implements FilterParser {
     }
   }
 
+  private boolean isLastFilterElement(String propertyName) {
+    final String lastElement = "/" + propertyName + " ";
+    return curExpression.contains(lastElement);
+  }
+
   protected void validateUnaryOperatorTypes(final UnaryExpression unaryExpression)
       throws ExpressionParserInternalError {
     InfoUnaryOperator unOpt = availableUnaryOperators.get(unaryExpression.getOperator().toUriLiteral());


Mime
View raw message