Ignore:
Timestamp:
2014-07-18T23:30:23+02:00 (12 years ago)
Author:
Don-vip
Message:

code simplification with some Java 7 new NIO2 Files methods (newBufferedReader, newBufferedWriter, readAllLines)

File:
1 edited

Legend:

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

    r7082 r7315  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.io.BufferedReader;
    76import java.io.File;
    8 import java.io.FileInputStream;
    97import java.io.FileNotFoundException;
    108import java.io.FileOutputStream;
    119import java.io.IOException;
    12 import java.io.InputStreamReader;
    1310import java.io.OutputStreamWriter;
    1411import java.io.PrintWriter;
    1512import java.nio.charset.StandardCharsets;
     13import java.nio.file.Files;
     14import java.nio.file.Path;
     15import java.nio.file.Paths;
    1616import java.util.ArrayList;
    1717import java.util.Arrays;
     
    170170        ignoredErrors.clear();
    171171        if (Main.pref.getBoolean(ValidatorPreference.PREF_USE_IGNORE, true)) {
    172             File file = new File(getValidatorDir() + "ignorederrors");
    173             if (file.exists()) {
    174                 try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) {
    175                     for (String line = in.readLine(); line != null; line = in.readLine()) {
    176                         ignoredErrors.add(line);
    177                     }
     172            Path path = Paths.get(getValidatorDir() + "ignorederrors");
     173            if (Files.exists(path)) {
     174                try {
     175                    ignoredErrors.addAll(Files.readAllLines(path, StandardCharsets.UTF_8));
    178176                } catch (final FileNotFoundException e) {
    179177                    Main.debug(Main.getErrorMessage(e));
Note: See TracChangeset for help on using the changeset viewer.