Changeset 32790 in osm for applications/editors


Ignore:
Timestamp:
2016-08-09T02:00:51+02:00 (8 years ago)
Author:
donvip
Message:

sonar - squid:S2976 - "File.createTempFile" should not be used to create a directory

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/util/OdUtils.java

    r32545 r32790  
    55import java.io.FilenameFilter;
    66import java.io.IOException;
     7import java.nio.file.Files;
    78import java.util.ArrayList;
    89import java.util.List;
     
    8788
    8889    public static final File createTempDir() throws IOException {
    89         final File temp = File.createTempFile(TEMP_DIR_PREFIX, Long.toString(System.nanoTime()));
    90 
    91         if (!temp.delete()) {
    92             throw new IOException("Could not delete temp file: " + temp.getAbsolutePath());
    93         }
    94 
    95         if (!temp.mkdir()) {
    96             throw new IOException("Could not create temp directory: " + temp.getAbsolutePath());
    97         }
    98 
    99         return temp;
     90        return Files.createTempDirectory(TEMP_DIR_PREFIX).toFile();
    10091    }
    10192
Note: See TracChangeset for help on using the changeset viewer.