Ignore:
Timestamp:
2014-04-26T15:28:16+02:00 (10 years ago)
Author:
Don-vip
Message:

see #8465 - use multi-catch where applicable

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
2 edited

Legend:

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

    r6992 r7004  
    3232
    3333/**
    34  * Loads a JOSM session
     34 * Loads a JOSM session.
    3535 * @since 4668
    3636 */
     
    174174                }
    175175            } catch (IllegalDataException e) {
    176                 Main.error(e);
    177                 HelpAwareOptionPane.showMessageDialogInEDT(
    178                         Main.parent,
    179                         tr("<html>Could not load session file ''{0}''.<br>Error is:<br>{1}</html>", uri != null ? uri : file.getName(), e.getMessage()),
    180                         tr("Data Error"),
    181                         JOptionPane.ERROR_MESSAGE,
    182                         null
    183                         );
    184                 cancel();
     176                handleException(tr("Data Error"), e);
    185177            } catch (IOException e) {
    186                 Main.error(e);
    187                 HelpAwareOptionPane.showMessageDialogInEDT(
    188                         Main.parent,
    189                         tr("<html>Could not load session file ''{0}''.<br>Error is:<br>{1}</html>", uri != null ? uri : file.getName(), e.getMessage()),
    190                         tr("IO Error"),
    191                         JOptionPane.ERROR_MESSAGE,
    192                         null
    193                         );
    194                 cancel();
     178                handleException(tr("IO Error"), e);
    195179            } catch (RuntimeException e) {
    196180                cancel();
     
    201185            }
    202186        }
     187       
     188        private void handleException(String dialogTitle, Exception e) {
     189            Main.error(e);
     190            HelpAwareOptionPane.showMessageDialogInEDT(
     191                    Main.parent,
     192                    tr("<html>Could not load session file ''{0}''.<br>Error is:<br>{1}</html>", uri != null ? uri : file.getName(), e.getMessage()),
     193                    dialogTitle,
     194                    JOptionPane.ERROR_MESSAGE,
     195                    null
     196                    );
     197            cancel();
     198        }
    203199    }
    204200}
    205 
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadSessionTask.java

    r6643 r7004  
    55
    66import java.io.IOException;
    7 import java.net.MalformedURLException;
    87import java.net.URISyntaxException;
    98import java.net.URL;
     
    5453                loader = new Loader(Utils.openURL(u), u.toURI(), url.endsWith(".joz"));
    5554                return Main.worker.submit(loader);
    56             } catch (URISyntaxException e) {
    57                 Main.error(e);
    58             } catch (MalformedURLException e) {
    59                 Main.error(e);
    60             } catch (IOException e) {
     55            } catch (URISyntaxException | IOException e) {
    6156                Main.error(e);
    6257            }
Note: See TracChangeset for help on using the changeset viewer.