Changeset 12590 in josm


Ignore:
Timestamp:
2017-08-11T09:59:03+02:00 (7 years ago)
Author:
Don-vip
Message:

fix #15133 - NPE at HttpClient.disconnect

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/HttpClient.java

    r11879 r12590  
    654654
    655655    private static void disconnect(final HttpURLConnection connection) {
    656         // Fix upload aborts - see #263
    657         connection.setConnectTimeout(100);
    658         connection.setReadTimeout(100);
    659         try {
    660             Thread.sleep(100);
    661         } catch (InterruptedException ex) {
    662             Main.warn("InterruptedException in " + HttpClient.class + " during cancel");
    663             Thread.currentThread().interrupt();
    664         }
    665         connection.disconnect();
     656        if (connection != null) {
     657            // Fix upload aborts - see #263
     658            connection.setConnectTimeout(100);
     659            connection.setReadTimeout(100);
     660            try {
     661                Thread.sleep(100);
     662            } catch (InterruptedException ex) {
     663                Main.warn("InterruptedException in " + HttpClient.class + " during cancel");
     664                Thread.currentThread().interrupt();
     665            }
     666            connection.disconnect();
     667        }
    666668    }
    667669}
Note: See TracChangeset for help on using the changeset viewer.