You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ra...@apache.org on 2020/02/26 06:09:23 UTC

[olingo-odata4] branch master updated: [OLINGO-1368]Fix for OData in operator for Integer values

This is an automated email from the ASF dual-hosted git repository.

ramyav pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/olingo-odata4.git


The following commit(s) were added to refs/heads/master by this push:
     new ac7d8db  [OLINGO-1368]Fix for OData in operator for Integer values
ac7d8db is described below

commit ac7d8dbd62d4b284b580618bfb1cac4bf7831e73
Author: ramya vasanth <ra...@sap.com>
AuthorDate: Wed Feb 26 11:39:11 2020 +0530

    [OLINGO-1368]Fix for OData in operator for Integer values
---
 .../olingo/server/core/uri/parser/ExpressionParser.java       | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ExpressionParser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ExpressionParser.java
index cf2074a..8f69f81 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ExpressionParser.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ExpressionParser.java
@@ -338,7 +338,7 @@ public class ExpressionParser {
       if (tokenizer.next(TokenKind.OPEN)) {
         ParserHelper.bws(tokenizer);
         List<Expression> expressionList = parseInExpr();
-        checkInExpressionTypes(expressionList, kinds);
+        checkInExpressionTypes(expressionList, leftExprType);
         return new BinaryImpl(left, BinaryOperatorKind.IN, expressionList,
             odata.createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Boolean));
       } else {
@@ -354,19 +354,20 @@ public class ExpressionParser {
 
   /**
    * @param expressionList
-   * @param kinds
+   * @param leftExprType
    * @throws UriParserException
    * @throws UriParserSemanticException
    */
-  private void checkInExpressionTypes(List<Expression> expressionList, EdmPrimitiveTypeKind kinds)
+  private void checkInExpressionTypes(List<Expression> expressionList, EdmType leftExprType)
       throws UriParserException, UriParserSemanticException {
     for (Expression expr : expressionList) {
       EdmType inExprType = getType(expr);
-      if (!isType(inExprType, kinds)) {
+      
+      if (!(((EdmPrimitiveType) leftExprType).isCompatible((EdmPrimitiveType) inExprType))) {
         throw new UriParserSemanticException("Incompatible types.",
             UriParserSemanticException.MessageKeys.TYPES_NOT_COMPATIBLE,
             inExprType == null ? "" : inExprType.getFullQualifiedName().getFullQualifiedNameAsString(),
-            kinds.getFullQualifiedName().getFullQualifiedNameAsString());
+            leftExprType.getFullQualifiedName().getFullQualifiedNameAsString());
       }
     }
   }