wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r935420 - in /incubator/wink/trunk/wink-common/src: main/java/org/apache/wink/common/internal/UriBuilderImpl.java test/java/org/apache/wink/common/internal/UriBuilderImplTest.java
Date Sun, 18 Apr 2010 21:54:31 GMT
Author: bluk
Date: Sun Apr 18 21:54:30 2010
New Revision: 935420

URL: http://svn.apache.org/viewvc?rev=935420&view=rev
Log:
UriBuilder fix when query param has no value

Modified:
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/UriBuilderImpl.java
    incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/UriBuilderImplTest.java

Modified: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/UriBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/UriBuilderImpl.java?rev=935420&r1=935419&r2=935420&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/UriBuilderImpl.java
(original)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/UriBuilderImpl.java
Sun Apr 18 21:54:30 2010
@@ -298,12 +298,12 @@ public class UriBuilderImpl extends UriB
                 eQueryValue = UriEncoder.encodeQueryParam(eQueryValue, true);
                 out.append(delim);
                 out.append(eQueryParam);
+                delim = '&';
                 if (eQueryValue == null) {
                     continue;
                 }
                 out.append('=');
                 out.append(eQueryValue);
-                delim = '&';
             }
         }
         logger.debug("buildQuery() exit - changes out to {}", out); //$NON-NLS-1$

Modified: incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/UriBuilderImplTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/UriBuilderImplTest.java?rev=935420&r1=935419&r2=935420&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/UriBuilderImplTest.java
(original)
+++ incubator/wink/trunk/wink-common/src/test/java/org/apache/wink/common/internal/UriBuilderImplTest.java
Sun Apr 18 21:54:30 2010
@@ -214,6 +214,22 @@ public class UriBuilderImplTest extends 
         builder.replaceQuery("q3={v1}&q4={v2}");
         uriString = builder.build("b#3", "b4").toString();
         assertEquals("?q3=b%233&q4=b4", uriString);
+
+        builder.replaceQuery("q3={v1}&q4=");
+        uriString = builder.build("b4").toString();
+        assertEquals("?q3=b4&q4=", uriString);
+
+        builder.replaceQuery("q3={v1}&q4");
+        uriString = builder.build("b4").toString();
+        assertEquals("?q3=b4&q4", uriString);
+
+        builder.replaceQuery("q3=&q4={v2}");
+        uriString = builder.build("b4").toString();
+        assertEquals("?q3=&q4=b4", uriString);
+
+        builder.replaceQuery("q3&q4={v2}");
+        uriString = builder.build("b4").toString();
+        assertEquals("?q3&q4=b4", uriString);
     }
 
     public void testSchemeSpecificPart() {



Mime
View raw message