cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6122] Internally decoding a query plus character passed in the init URI to avoid double encoding it
Date Tue, 02 Dec 2014 10:40:04 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 8ef743e87 -> fc64f1c05


[CXF-6122] Internally decoding a query plus character passed in the init URI to avoid double
encoding it


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

Branch: refs/heads/master
Commit: fc64f1c05e34f402ef9d88ee54c2a3b193b64432
Parents: 8ef743e
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Dec 2 10:39:44 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Dec 2 10:39:44 2014 +0000

----------------------------------------------------------------------
 .../src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java | 2 +-
 .../src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java    | 5 ++++-
 .../test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/fc64f1c0/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
index 53ca8fe..84065b1 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
@@ -632,7 +632,7 @@ public class UriBuilderImpl extends UriBuilder implements Cloneable {
             }
             String rawQuery = uri.getRawQuery();
             if (rawQuery != null) {
-                query = JAXRSUtils.getStructuredParams(rawQuery, "&", false, false);
+                query = JAXRSUtils.getStructuredParams(rawQuery, "&", false, true);
             }
             userInfo = uri.getUserInfo();
             schemeSpecificPart = null;

http://git-wip-us.apache.org/repos/asf/cxf/blob/fc64f1c0/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
index 61308b0..d26cccc 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
@@ -1238,7 +1238,10 @@ public final class JAXRSUtils {
                 } else {
                     name = part.substring(0, index);
                     value =  index < part.length() ? part.substring(index + 1) : "";
-                    if (decode || (decodePlus && value.contains("+"))) {
+                    if (decodePlus && value.contains("+")) {
+                        value = value.replace('+', ' ');
+                    }
+                    if (decode) {
                         value = (";".equals(sep))
                             ? HttpUtils.pathDecode(value) : HttpUtils.urlDecode(value); 
                     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/fc64f1c0/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
index fce1186..3abe884 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
@@ -423,7 +423,7 @@ public class UriBuilderImplTest extends Assert {
         URI uri = new URI("http://bar/foo+%20%2B?q=a+b%20%2B");
         URI newUri = new UriBuilderImpl(uri).buildFromEncoded();   
         assertEquals("URI is not built correctly", 
-                     "http://bar/foo+%20%2B?q=a%2Bb%20%2B", newUri.toString());
+                     "http://bar/foo+%20%2B?q=a+b%20%2B", newUri.toString());
     }
     
     @Test


Mime
View raw message