Ticket #1841: josm-1841-manifest_lookup.patch

File josm-1841-manifest_lookup.patch, 1.5 KB (added by stephankn, 15 years ago)

patch fixing the described problem

  • src/org/openstreetmap/josm/actions/AboutAction.java

     
    1212import java.io.IOException;
    1313import java.io.InputStream;
    1414import java.io.InputStreamReader;
     15import java.net.MalformedURLException;
    1516import java.net.URL;
    1617import java.util.Map.Entry;
    1718import java.util.regex.Matcher;
     
    5051        private final static JTextArea revision;
    5152        private static String time;
    5253
    53         static {
    54                 URL u = Main.class.getResource("/REVISION");
    55                 if(u == null) u = Main.class.getResource("/META-INF/MANIFEST.MF");
     54    static {
     55        URL u = Main.class.getResource("/REVISION");
     56        if(u == null) {
     57            try {
     58                u = new URL("jar:" + Main.class.getProtectionDomain().getCodeSource().getLocation().toString()
     59                        + "!/META-INF/MANIFEST.MF");
     60            } catch (MalformedURLException e) {
     61                e.printStackTrace();
     62            }
     63        }
    5664                revision = loadFile(u);
    5765
    58                 Pattern versionPattern = Pattern.compile(".*?(?:Revision|Main-Version): ([0-9]*).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL);
     66                Pattern versionPattern = Pattern.compile(".*?(?:Revision|Main-Version): ([0-9]*(?: SVN)?).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL);
    5967                Matcher match = versionPattern.matcher(revision.getText());
    6068                version = match.matches() ? match.group(1) : tr("UNKNOWN");
    6169