commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maurice Schneider" <maurice.schnei...@unicible.ch>
Subject httpclient, report for bug in org.apache.commons.httpclient.HttpMethodBase
Date Tue, 07 Jan 2003 08:00:09 GMT
Hello,

I'm not very familiar with the bug fixing process.

I've found a bug in one of the HttpMethodBase.

    /**
     * Constructor specifying a URI.
     *
     * @param uri either an absolute or relative URI
     */
    public HttpMethodBase(String uri) {

        try {
           ...
        } catch ( MalformedURLException e ) {
            // this is not a URL
            int pa = uri.indexOf("?");

            if ( !uri.startsWith("/") ) {
                // this path must be relative to root
                uri = "/" + uri;
            }

            if (pa < 0) { //its just a path
                setPath(uri);
            }
            else { //its a path with a query
305c305
<                 setPath(path.substring(0, pa));
---
>                 setPath(uri.substring(0, pa));
                  setQueryString(uri.substring(pa+1, uri.length()));
            }
        }

The bug produces a Null pointer exception with such a stmt:

                        GetMethod method = new GetMethod 
("/www.blabla.ch/toto?titi") ;

cheers
_________________________
Maurice Schneider
Unicible

tel: +41 (0)21/644 6074
fax: +41 (0)21/644 6300
mailto:maurice.schneider@unicible.ch
http://www.unicible.ch
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message