- Timestamp:
- 2023-12-31T21:12:20+01:00 (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/animation/DropImage.java
r18930 r18931 68 68 String name = "logo"; 69 69 try { 70 ArrayList<String> result = new ArrayList< String>();70 ArrayList<String> result = new ArrayList<>(); 71 71 String path = "images/presets/"; 72 72 URL url = DropImage.class.getClassLoader().getResource(path); 73 73 if (url != null && url.getProtocol().equals("file")) { 74 ArrayList<File> dirs = new ArrayList< File>();74 ArrayList<File> dirs = new ArrayList<>(); 75 75 dirs.add(new File(url.toURI())); 76 76 do { … … 82 82 } 83 83 } 84 } while ( dirs.size() > 0);84 } while (!dirs.isEmpty()); 85 85 name = result.get(seed.nextInt(result.size())); 86 86 } else if (url != null && url.getProtocol().equals("jar")) { 87 87 String jarPath = url.getPath().substring(5, url.getPath().indexOf("!")); 88 JarFile jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8")); 89 Enumeration<JarEntry> entries = jar.entries(); 90 while (entries.hasMoreElements()) { 91 String fileName = entries.nextElement().getName(); 92 if (fileName.startsWith(path) && !fileName.endsWith("/")) { 93 result.add(fileName.substring(7)); 88 try (JarFile jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8"))) { 89 Enumeration<JarEntry> entries = jar.entries(); 90 while (entries.hasMoreElements()) { 91 String fileName = entries.nextElement().getName(); 92 if (fileName.startsWith(path) && !fileName.endsWith("/")) { 93 result.add(fileName.substring(7)); 94 } 94 95 } 95 96 }
Note:
See TracChangeset
for help on using the changeset viewer.