Changeset 13838 in josm for trunk/src/org


Ignore:
Timestamp:
2018-05-26T02:47:41+02:00 (7 years ago)
Author:
Don-vip
Message:

fix #16316 - catch InvalidPathException

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/Main.java

    r13647 r13838  
    99import java.lang.ref.WeakReference;
    1010import java.net.URL;
     11import java.nio.file.InvalidPathException;
    1112import java.util.Collection;
    1213import java.util.Collections;
     
    347348        try {
    348349            pref.saveDefaults();
    349         } catch (IOException ex) {
     350        } catch (IOException | InvalidPathException ex) {
    350351            Logging.log(Logging.LEVEL_WARN, tr("Failed to save default preferences."), ex);
    351352        }
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r13769 r13838  
    1414import java.io.StringWriter;
    1515import java.nio.charset.StandardCharsets;
     16import java.nio.file.InvalidPathException;
    1617import java.util.ArrayList;
    1718import java.util.Collection;
     
    594595                save();
    595596            }
    596         } catch (IOException e) {
     597        } catch (IOException | InvalidPathException e) {
    597598            Logging.error(e);
    598599            if (!GraphicsEnvironment.isHeadless()) {
     
    698699                try {
    699700                    save();
    700                 } catch (IOException e) {
     701                } catch (IOException | InvalidPathException e) {
    701702                    File file = getPreferenceFile();
    702703                    try {
  • trunk/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java

    r12854 r13838  
    1111import java.io.IOException;
    1212import java.io.OutputStream;
     13import java.nio.file.InvalidPathException;
    1314import java.text.MessageFormat;
    1415import java.time.Year;
     
    209210            new GpxWriter(fo).write(gpxData);
    210211            fo.flush();
    211         } catch (IOException ex) {
     212        } catch (IOException | InvalidPathException ex) {
    212213            Logging.error(ex);
    213214            JOptionPane.showMessageDialog(Main.parent, tr("Error while exporting {0}:\n{1}", fn, ex.getMessage()),
  • trunk/src/org/openstreetmap/josm/gui/io/importexport/OsmExporter.java

    r13352 r13838  
    1111import java.io.Writer;
    1212import java.nio.charset.StandardCharsets;
     13import java.nio.file.InvalidPathException;
    1314import java.text.MessageFormat;
    1415
     
    9596            }
    9697            layer.onPostSaveToFile();
    97         } catch (IOException e) {
     98        } catch (IOException | InvalidPathException e) {
    9899            Logging.error(e);
    99100            JOptionPane.showMessageDialog(
     
    110111                    Utils.copyFile(tmpFile, file);
    111112                }
    112             } catch (IOException e2) {
     113            } catch (IOException | InvalidPathException e2) {
    113114                Logging.error(e2);
    114115                JOptionPane.showMessageDialog(
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java

    r13761 r13838  
    1010import java.io.File;
    1111import java.io.IOException;
     12import java.nio.file.InvalidPathException;
    1213import java.util.ArrayList;
    1314import java.util.Collections;
     
    341342                    try {
    342343                        Main.pref.save();
    343                     } catch (IOException e) {
    344                         Logging.log(Logging.LEVEL_WARN, "IOException while saving preferences:", e);
     344                    } catch (IOException | InvalidPathException e) {
     345                        Logging.log(Logging.LEVEL_WARN, "Exception while saving preferences:", e);
    345346                    }
    346347                    readPreferences(Main.pref);
  • trunk/src/org/openstreetmap/josm/io/Compression.java

    r13350 r13838  
    88import java.nio.charset.StandardCharsets;
    99import java.nio.file.Files;
     10import java.nio.file.InvalidPathException;
    1011import java.util.zip.GZIPInputStream;
    1112import java.util.zip.GZIPOutputStream;
     
    213214     *
    214215     * @throws IOException if any I/O error occurs
     216     * @throws InvalidPathException if a Path object cannot be constructed from the abstract path
    215217     */
    216218    public static OutputStream getCompressedFileOutputStream(File file) throws IOException {
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r13836 r13838  
    2424import java.nio.charset.StandardCharsets;
    2525import java.nio.file.Files;
     26import java.nio.file.InvalidPathException;
    2627import java.nio.file.Path;
    2728import java.nio.file.Paths;
     
    392393     * @throws IOException if any I/O error occurs
    393394     * @throws IllegalArgumentException if {@code in} or {@code out} is {@code null}
     395     * @throws InvalidPathException if a Path object cannot be constructed from the abstract path
    394396     * @since 7003
    395397     */
Note: See TracChangeset for help on using the changeset viewer.