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:42:43 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes f88b3127f -> 60b50e10b


[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/60b50e10
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/60b50e10
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/60b50e10

Branch: refs/heads/2.7.x-fixes
Commit: 60b50e10b6ed05eb3d30b7bc3c15fe85017f7605
Parents: f88b312
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:42:25 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/60b50e10/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 deabe08..127c6a0 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
@@ -593,7 +593,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/60b50e10/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 f7fb8b1..130c75e 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
@@ -1173,7 +1173,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/60b50e10/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 51b5264..898168d 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
@@ -329,7 +329,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