Changeset 11096 in josm for trunk


Ignore:
Timestamp:
2016-10-08T02:01:09+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:S3725 - Java 8's Files.exists should not be used (The Files.exists method has noticeably poor performance in JDK 8, and can slow an application significantly when used to check files that don't actually exist)

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r10952 r11096  
    183183        if (ValidatorPreference.PREF_USE_IGNORE.get()) {
    184184            Path path = Paths.get(getValidatorDir()).resolve("ignorederrors");
    185             if (Files.exists(path)) {
     185            if (path.toFile().exists()) {
    186186                try {
    187187                    ignoredErrors.addAll(Files.readAllLines(path, StandardCharsets.UTF_8));
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpsServer.java

    r10632 r11096  
    207207        Files.createDirectories(dir);
    208208
    209         if (!Files.exists(path)) {
     209        if (!path.toFile().exists()) {
    210210            Main.debug("No keystore found, creating a new one");
    211211
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java

    r10734 r11096  
    217217        try {
    218218            // CHECKSTYLE.OFF: SingleSpaceSeparator
    219             boolean dpkg = Files.exists(Paths.get("/usr/bin/dpkg-query"));
    220             boolean eque = Files.exists(Paths.get("/usr/bin/equery"));
    221             boolean rpm  = Files.exists(Paths.get("/bin/rpm"));
     219            boolean dpkg = Paths.get("/usr/bin/dpkg-query").toFile().exists();
     220            boolean eque = Paths.get("/usr/bin/equery").toFile().exists();
     221            boolean rpm  = Paths.get("/bin/rpm").toFile().exists();
    222222            // CHECKSTYLE.ON: SingleSpaceSeparator
    223223            if (dpkg || rpm || eque) {
     
    390390            if (path != null) {
    391391                Path p = Paths.get(path);
    392                 if (Files.exists(p)) {
     392                if (p.toFile().exists()) {
    393393                    try (BufferedReader reader = Files.newBufferedReader(p, StandardCharsets.UTF_8)) {
    394394                        String id = null;
Note: See TracChangeset for help on using the changeset viewer.