Re: [netcdf-java] Small bug in HttpClientManager

Oops, forgot to copy this to the list.

Windows XP Home and Sun JVM 1.5.0_09.  However, if I run a very simple
program that just calls HttpClientManager.init() the problem doesn't
happen.  Therefore I think that one of the libraries that I use in my
more complex application is setting the http.proxyPort property to the
empty string internally.  I don't think this is a function of my OS or
JVM.

Jon

On Dec 17, 2007 5:39 PM, John Caron <caron@xxxxxxxxxxxxxxxx> wrote:
> thnkas for the heads up. what OS and JVM do you see this problem on?
>
>
> Jon Blower wrote:
> > Hi all (particularly John C),
> >
> > I've spotted a small bug in HttpClientManager in the section below:
> >
> >     // nick.bower@xxxxxxxxxxxxxxxxxxxxx
> >     String proxyHost = System.getProperty("http.proxyHost");
> >     String proxyPort = System.getProperty("http.proxyPort");
> >     if ((proxyHost != null) && (proxyPort != null)) {
> >         _client.getHostConfiguration().setProxy(proxyHost,
> > Integer.parseInt(proxyPort));
> >     }
> >
> > The problem here is that if the "http.proxyPort" property is set to
> > the empty string, the call to Integer.parseInt() fails and the class
> > doesn't get initialized.  (For some reason http.proxyPort is set to ""
> > on my system instead of null - don't know why, I'm not doing this
> > consciously.)
> >
> > I suggest changing the if clause to:
> >
> >     if ((proxyHost != null) && (proxyPort != null) &&
> > !proxyPort.trim().equals("")) {
> >
> > Cheers, Jon
> >
> >
>



-- 
--------------------------------------------------------------
Dr Jon Blower              Tel: +44 118 378 5213 (direct line)
Technical Director         Tel: +44 118 378 8741 (ESSC)
Reading e-Science Centre   Fax: +44 118 378 6413
ESSC                       Email: jdb@xxxxxxxxxxxxxxxxxxxx
University of Reading
3 Earley Gate
Reading RG6 6AL, UK
--------------------------------------------------------------