commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janek Bogucki <...@studylink.com>
Subject [latka] [PATCH] RequestImpl.setVersion () throws NPE
Date Tue, 17 Sep 2002 11:07:14 GMT
Hi,

I'm trying to build CVS latka with CVS httpclient and I encountered a NPE in 
RequestImpl.setVersion. My patch changes this method to match the meaning of 
the API comments by using HTTP/1.1 when the parameter is not "1.1", i.e. when 
it is null use "HTTP/1.1".

Maybe this is the wrong way to fix this, maybe the invoker of 
RequestImpl.setVersion should be fixed to never pass in null.

Can someone review my patch and apply it or not.

http://issues.apache.org/bugzilla/show_bug.cgi?id=12727

Thanks,
Janek Bogucki

>From above URL:
---------------

The CVS version of latka using the CVS version of httpclient was throwing this
exception

Exception in thread "main" java.lang.NullPointerException
        at org.apache.commons.latka.http.RequestImpl.setVersion(Unknown 
Source)
        at org.apache.commons.latka.http.SessionImpl.createRequest(Unknown 
Source)
        at org.apache.commons.latka.xml.RequestHandler.buildRequest(Unknown 
Source)
        at org.apache.commons.latka.xml.RequestHandler.startElement(Unknown 
Source)
        at
org.apache.commons.latka.util.xml.BasicDelegateHandler.delegate(Unknown 
Source)

and this patchs setVersion to use HTTP/1.1 when the version string is null.

Index: RequestImpl.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/latka/src/java/org/apache/commons/latka/http/RequestImpl.java,v
retrieving revision 1.29
diff -u -r1.29 RequestImpl.java
--- RequestImpl.java	4 Sep 2002 02:59:26 -0000	1.29
+++ RequestImpl.java	17 Sep 2002 09:49:56 -0000
@@ -511,8 +511,10 @@
      * @param version  HTTP version
      */
     public void setVersion(String version) {
-        if (version.equals(HTTP_10)) {
+        if (HTTP_10.equals(version)) {
             ((HttpMethodBase) _httpMethod).setHttp11(false);
+        } else {
+            ((HttpMethodBase) _httpMethod).setHttp11(true);
         }
     }
 }

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message