Ignore:
Timestamp:
2018-11-03T01:07:53+01:00 (5 years ago)
Author:
Don-vip
Message:

see #16937 - Support user logins with space character on Java 11 (JOSM startup)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/Version.java

    r14273 r14406  
    66import java.io.IOException;
    77import java.io.InputStream;
     8import java.net.URL;
     9import java.nio.file.InvalidPathException;
    810import java.util.Map.Entry;
    911import java.util.Optional;
     
    105107     */
    106108    public void init() {
    107         try (InputStream stream = Version.class.getResourceAsStream("/REVISION")) {
     109        try (InputStream stream = openRevisionStream("/REVISION")) {
    108110            if (stream == null) {
    109111                Logging.warn(tr("The revision file ''/REVISION'' is missing."));
     
    118120    }
    119121
     122    private static InputStream openRevisionStream(String path) throws IOException {
     123        try {
     124            return Version.class.getResourceAsStream(path);
     125        } catch (InvalidPathException e) {
     126            Logging.error("Cannot open {0}: {1}", path, e.getMessage());
     127            URL betterUrl = Utils.betterJarUrl(Version.class.getResource(path));
     128            if (betterUrl != null) {
     129                return betterUrl.openStream();
     130            }
     131            return null;
     132        }
     133    }
     134
    120135    /**
    121136     * Replies the version string. Either the SVN revision "1234" (as string) or the
Note: See TracChangeset for help on using the changeset viewer.