Changeset 1487 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2009-03-12T18:40:08+01:00 (15 years ago)
Author:
stoecker
Message:

remove signed data from manifest display

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AboutAction.java

    r1484 r1487  
    5454
    5555    static {
     56        boolean manifest = false;
    5657        URL u = Main.class.getResource("/REVISION");
    5758        if(u == null) {
    5859            try {
     60                manifest = true;
    5961                u = new URL("jar:" + Main.class.getProtectionDomain().getCodeSource().getLocation().toString()
    6062                        + "!/META-INF/MANIFEST.MF");
     
    6365            }
    6466        }
    65         revision = loadFile(u);
     67        revision = loadFile(u, manifest);
    6668
    6769        Pattern versionPattern = Pattern.compile(".*?(?:Revision|Main-Version): ([0-9]*(?: SVN)?).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL);
     
    122124        JTabbedPane about = new JTabbedPane();
    123125
    124         JTextArea readme = loadFile(Main.class.getResource("/README"));
    125         JTextArea contribution = loadFile(Main.class.getResource("/CONTRIBUTION"));
     126        JTextArea readme = loadFile(Main.class.getResource("/README"), false);
     127        JTextArea contribution = loadFile(Main.class.getResource("/CONTRIBUTION"), false);
    126128
    127129        JPanel info = new JPanel(new GridBagLayout());
     
    187189     * @return  An read-only text area with the content of "resource"
    188190     */
    189     private static JTextArea loadFile(URL resource) {
     191    private static JTextArea loadFile(URL resource, boolean manifest) {
    190192        JTextArea area = new JTextArea(tr("File could not be found."));
    191193        area.setEditable(false);
     
    198200        try {
    199201            in = new BufferedReader(new InputStreamReader(resource.openStream()));
    200             StringBuilder sb = new StringBuilder();
    201             for (String line = in.readLine(); line != null; line = in.readLine()) {
    202                 sb.append(line);
    203                 sb.append('\n');
     202            String s = "";
     203            for (String line = in.readLine(); line != null; line = in.readLine())
     204                s += line + "\n";
     205            if(manifest)
     206            {
     207                s = Pattern.compile("\n ", Pattern.DOTALL).matcher(s).replaceAll("");
     208                s = Pattern.compile("^(SHA1-Digest|Name): .*?$", Pattern.DOTALL|Pattern.MULTILINE).matcher(s).replaceAll("");
     209                s = Pattern.compile("\n+$", Pattern.DOTALL).matcher(s).replaceAll("");
    204210            }
    205             area.setText(sb.toString());
     211            area.setText(s);
    206212            area.setCaretPosition(0);
    207213        } catch (IOException e) {
Note: See TracChangeset for help on using the changeset viewer.