Changeset 11509 in josm


Ignore:
Timestamp:
2017-01-29T19:24:14+01:00 (5 months ago)
Author:
Don-vip
Message:

fix #14305 - allow file:// URL for command-line argument --load-preferences

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r11455 r11509  
    283283            for (String i : args.get(Option.LOAD_PREFERENCES)) {
    284284                info("Reading preferences from " + i);
    285                 try (InputStream is = HttpClient.create(new URL(i)).connect().getContent()) {
     285                try (InputStream is = openStream(new URL(i))) {
    286286                    config.openAndReadXML(is);
    287287                } catch (IOException ex) {
     
    382382            info("Enabled EDT checker, wrongful access to gui from non EDT thread will be printed to console");
    383383            RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager());
     384        }
     385    }
     386
     387    private static InputStream openStream(URL url) throws IOException {
     388        if ("file".equals(url.getProtocol())) {
     389            return url.openStream();
     390        } else {
     391            return HttpClient.create(url).connect().getContent();
    384392        }
    385393    }
Note: See TracChangeset for help on using the changeset viewer.