Re: [netcdf-java] Small bug in HttpClientManager

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



  • 2007 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: