Changeset 14406 in josm for trunk/src/org/openstreetmap/josm/data/Version.java
- Timestamp:
- 2018-11-03T01:07:53+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Version.java
r14273 r14406 6 6 import java.io.IOException; 7 7 import java.io.InputStream; 8 import java.net.URL; 9 import java.nio.file.InvalidPathException; 8 10 import java.util.Map.Entry; 9 11 import java.util.Optional; … … 105 107 */ 106 108 public void init() { 107 try (InputStream stream = Version.class.getResourceAsStream("/REVISION")) {109 try (InputStream stream = openRevisionStream("/REVISION")) { 108 110 if (stream == null) { 109 111 Logging.warn(tr("The revision file ''/REVISION'' is missing.")); … … 118 120 } 119 121 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 120 135 /** 121 136 * Replies the version string. Either the SVN revision "1234" (as string) or the
Note:
See TracChangeset
for help on using the changeset viewer.