Ignore:
Timestamp:
2017-12-17T00:17:20+01:00 (6 years ago)
Author:
Don-vip
Message:

enable new PMD rule AvoidFileStream - see https://pmd.github.io/pmd-6.0.0/pmd_rules_java_performance.html#avoidfilestream / https://bugs.openjdk.java.net/browse/JDK-8080225 for details

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadFileTask.java

    r12620 r13204  
    66import java.awt.Component;
    77import java.io.File;
    8 import java.io.FileOutputStream;
    98import java.io.IOException;
    109import java.io.InputStream;
     
    1413import java.nio.charset.StandardCharsets;
    1514import java.nio.file.Files;
     15import java.nio.file.InvalidPathException;
    1616import java.nio.file.StandardCopyOption;
    1717import java.util.Enumeration;
     
    115115            try (
    116116                InputStream in = downloadConnection.getResponse().getContent();
    117                 OutputStream out = new FileOutputStream(file)
     117                OutputStream out = Files.newOutputStream(file.toPath())
    118118            ) {
    119119                byte[] buffer = new byte[32_768];
     
    145145            Logging.warn(msg);
    146146            throw new DownloadException(msg, e);
    147         } catch (IOException e) {
     147        } catch (IOException | InvalidPathException e) {
    148148            if (canceled)
    149149                return;
Note: See TracChangeset for help on using the changeset viewer.