hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r240454 - in /jakarta/httpclient/trunk/http-common/src: java/org/apache/http/util/ParameterParser.java test/org/apache/http/TestHeaderElement.java test/org/apache/http/util/TestParameterParser.java
Date Sat, 27 Aug 2005 20:12:21 GMT
Author: olegk
Date: Sat Aug 27 13:12:13 2005
New Revision: 240454

URL: http://svn.apache.org/viewcvs?rev=240454&view=rev
Log:
PR #36140 (ParameterParser parse method for authentication headers does not appear to deal
with empty value strings)

ParameterParser changed to correctly differentiate between empty and null (no value) parameters

Contributed by Oleg Kalnichevski
Reviewed by Ortwin Gl├╝ck

Modified:
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/util/ParameterParser.java
    jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeaderElement.java
    jakarta/httpclient/trunk/http-common/src/test/org/apache/http/util/TestParameterParser.java

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/util/ParameterParser.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/util/ParameterParser.java?rev=240454&r1=240453&r2=240454&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/util/ParameterParser.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/util/ParameterParser.java
Sat Aug 27 13:12:13 2005
@@ -97,7 +97,7 @@
             }
         }
         String result = null;
-        if (i2 > i1) {
+        if (i2 >= i1) {
             result = new String(chars, i1, i2 - i1);
         }
         return result;

Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeaderElement.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeaderElement.java?rev=240454&r1=240453&r2=240454&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeaderElement.java (original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeaderElement.java Sat
Aug 27 13:12:13 2005
@@ -111,7 +111,7 @@
         // 1st element has 2 getParameters()
         assertEquals(2,elements[0].getParameters().length);
         assertEquals("name2",elements[0].getParameters()[0].getName());
-        assertTrue(null == elements[0].getParameters()[0].getValue());
+        assertEquals(null, elements[0].getParameters()[0].getValue());
         assertEquals("name3",elements[0].getParameters()[1].getName());
         assertEquals("value3",elements[0].getParameters()[1].getValue());
         // 2nd element
@@ -123,7 +123,7 @@
         assertEquals("value5",elements[1].getParameters()[0].getValue());
         // 3rd element
         assertEquals("name6",elements[2].getName());
-        assertEquals(null,elements[2].getValue());
+        assertEquals("",elements[2].getValue());
         // 3rd element has 2 getParameters()
         assertEquals(2,elements[2].getParameters().length);
         assertEquals("name7",elements[2].getParameters()[0].getName());

Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/util/TestParameterParser.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/util/TestParameterParser.java?rev=240454&r1=240453&r2=240454&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/util/TestParameterParser.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/util/TestParameterParser.java
Sat Aug 27 13:12:13 2005
@@ -78,7 +78,7 @@
         assertEquals("test1", ((NameValuePair)params.get(1)).getName());
         assertEquals("stuff", ((NameValuePair)params.get(1)).getValue());
         assertEquals("test2", ((NameValuePair)params.get(2)).getName());
-        assertEquals(null, ((NameValuePair)params.get(2)).getValue());
+        assertEquals("", ((NameValuePair)params.get(2)).getValue());
         assertEquals("test3", ((NameValuePair)params.get(3)).getName());
         assertEquals(null, ((NameValuePair)params.get(3)).getValue());
 



Mime
View raw message