cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r966028 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
Date Tue, 20 Jul 2010 21:46:54 GMT
Author: sergeyb
Date: Tue Jul 20 21:46:53 2010
New Revision: 966028

URL: http://svn.apache.org/viewvc?rev=966028&view=rev
Log:
Merged revisions 966026 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r966026 | sergeyb | 2010-07-20 22:45:19 +0100 (Tue, 20 Jul 2010) | 1 line
  
  [CXF-2887] Fixing NPE in UriBuilderImpl
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 20 21:46:53 2010
@@ -1 +1 @@
-/cxf/trunk:965966
+/cxf/trunk:965966,966026

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java?rev=966028&r1=966027&r2=966028&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
Tue Jul 20 21:46:53 2010
@@ -162,8 +162,14 @@ public class UriBuilderImpl extends UriB
         // is promising unfortunatley it causes the loss of encoded reserved values such
as +,
         // which might cause problems if consumers do rely on URLEncoder which would turn
'+' into
         // ' ' or would break the contract in when query parameters are expected to have
%2B 
-        
+        if (values == null) {
+            throw new IllegalArgumentException("Template parameter values are set to null");
+        }
         for (int i = 0; i < values.length; i++) {
+            if (values[i] == null) {
+                throw new IllegalArgumentException("Template parameter value is set to null");
+            }
+            
             values[i] = HttpUtils.encodePartiallyEncoded(values[i].toString(), false);
         }
         return doBuild(true, values);

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java?rev=966028&r1=966027&r2=966028&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
Tue Jul 20 21:46:53 2010
@@ -126,6 +126,18 @@ public class UriBuilderImplTest extends 
         assertEquals("URI is not built correctly", "http://bar/", newUri.toString());
     }
     
+    @Test(expected = IllegalArgumentException.class)
+    public void testNullPathWithBuildEncoded() throws Exception {
+        URI uri = new URI("http://bar");
+        new UriBuilderImpl(uri).path("{bar}").buildFromEncoded((Object[])null);
+    }
+    
+    @Test(expected = IllegalArgumentException.class)
+    public void testNullPathWithBuildEncoded2() throws Exception {
+        URI uri = new URI("http://bar");
+        new UriBuilderImpl(uri).path("{bar}").buildFromEncoded(new Object[] {null});
+    }
+    
     @Test
     public void testPathTrailingSlash2() throws Exception {
         URI uri = new URI("http://bar");



Mime
View raw message