Ignore:
Timestamp:
2024-06-13T21:18:45+02:00 (9 months ago)
Author:
taylor.smock
Message:

Cleanup some new PMD warnings from PMD 7.x (followup of r19101)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/animation/DropImage.java

    r18932 r19106  
    99import java.net.URL;
    1010import java.net.URLDecoder;
     11import java.nio.charset.StandardCharsets;
    1112import java.util.ArrayList;
    1213import java.util.Enumeration;
     
    7172            String path = "images/presets/";
    7273            URL url = DropImage.class.getClassLoader().getResource(path);
    73             if (url != null && url.getProtocol().equals("file")) {
     74            if (url != null && "file".equals(url.getProtocol())) {
    7475                ArrayList<File> dirs = new ArrayList<>();
    7576                dirs.add(new File(url.toURI()));
     
    8788                } while (!dirs.isEmpty());
    8889                name = result.get(seed.nextInt(result.size()));
    89             } else if (url != null && url.getProtocol().equals("jar")) {
    90                 String jarPath = url.getPath().substring(5, url.getPath().indexOf("!"));
    91                 try (JarFile jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8"))) {
     90            } else if (url != null && "jar".equals(url.getProtocol())) {
     91                String jarPath = url.getPath().substring(5, url.getPath().indexOf('!'));
     92                try (JarFile jar = new JarFile(URLDecoder.decode(jarPath, StandardCharsets.UTF_8))) {
    9293                    Enumeration<JarEntry> entries = jar.entries();
    9394                    while (entries.hasMoreElements()) {
Note: See TracChangeset for help on using the changeset viewer.