Changeset 1487 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-03-12T18:40:08+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r1484 r1487 54 54 55 55 static { 56 boolean manifest = false; 56 57 URL u = Main.class.getResource("/REVISION"); 57 58 if(u == null) { 58 59 try { 60 manifest = true; 59 61 u = new URL("jar:" + Main.class.getProtectionDomain().getCodeSource().getLocation().toString() 60 62 + "!/META-INF/MANIFEST.MF"); … … 63 65 } 64 66 } 65 revision = loadFile(u );67 revision = loadFile(u, manifest); 66 68 67 69 Pattern versionPattern = Pattern.compile(".*?(?:Revision|Main-Version): ([0-9]*(?: SVN)?).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); … … 122 124 JTabbedPane about = new JTabbedPane(); 123 125 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); 126 128 127 129 JPanel info = new JPanel(new GridBagLayout()); … … 187 189 * @return An read-only text area with the content of "resource" 188 190 */ 189 private static JTextArea loadFile(URL resource ) {191 private static JTextArea loadFile(URL resource, boolean manifest) { 190 192 JTextArea area = new JTextArea(tr("File could not be found.")); 191 193 area.setEditable(false); … … 198 200 try { 199 201 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(""); 204 210 } 205 area.setText(s b.toString());211 area.setText(s); 206 212 area.setCaretPosition(0); 207 213 } catch (IOException e) {
Note:
See TracChangeset
for help on using the changeset viewer.