Repository: olingo-odata4
Updated Branches:
  refs/heads/master 0cf76f51c -> 7e262c8d0


OLINGO-846, OLINGO-1076: Expanding/relaxing the allowence of white space AFTER 
the query option is decoded. Also applying to name segment, note that this is 
only for user supplied queries


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

Branch: refs/heads/master
Commit: 7e262c8d073666ce923a9b65ea80b930b38d8d7c
Parents: 0cf76f5
Author: Ramesh Reddy <[email protected]>
Authored: Wed Apr 19 13:39:08 2017 -0500
Committer: Ramesh Reddy <[email protected]>
Committed: Wed Apr 19 13:39:08 2017 -0500

----------------------------------------------------------------------
 .../org/apache/olingo/server/core/uri/parser/UriDecoder.java   | 6 +++---
 .../apache/olingo/server/core/uri/parser/UriParserTest.java    | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7e262c8d/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java
----------------------------------------------------------------------
diff --git 
a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java
 
b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java
index 65cbd4f..9983cca 100644
--- 
a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java
+++ 
b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java
@@ -48,11 +48,11 @@ public class UriDecoder {
     for (final String option : split(queryOptionString, '&')) {
       final int pos = option.indexOf('=');
       final String name = pos >= 0 ? option.substring(0, pos)  : option;
+      final String text = pos >= 0 ? option.substring(pos + 1) : "";
       //OLINGO-846 We trim the query option text to be more lenient to wrong 
uri constructors
-      final String text = pos >= 0 ? option.substring(pos + 1).trim() : "";
       queryOptions.add(new CustomQueryOptionImpl()
-          .setName(decode(name))
-          .setText(decode(text)));
+          .setName(decode(name).trim())
+          .setText(decode(text).trim()));
     }
     return queryOptions;
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7e262c8d/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/UriParserTest.java
----------------------------------------------------------------------
diff --git 
a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/UriParserTest.java
 
b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/UriParserTest.java
index e77139a..5363e5c 100644
--- 
a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/UriParserTest.java
+++ 
b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/UriParserTest.java
@@ -905,6 +905,9 @@ public class UriParserTest {
     // OLINGO-846 trim query option value
     testUri.run("ESAllPrim", "$filter= PropertyInt16 eq 12 ")
         
.isKind(UriInfoKind.resource).goFilter().isBinary(BinaryOperatorKind.EQ).is("<<PropertyInt16>
 eq <12>>");
+    
+    testUri.run("ESAllPrim", "%20$filter%20=%20PropertyInt16%20%20eq%2012%20")
+      
.isKind(UriInfoKind.resource).goFilter().isBinary(BinaryOperatorKind.EQ).is("<<PropertyInt16>
 eq <12>>");    
   }
 
   @Test

Reply via email to