Ignore:
Timestamp:
2017-03-19T02:26:34+01:00 (3 years ago)
Author:
Don-vip
Message:

PMD - Strict Exceptions

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
6 edited

Legend:

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

    r11472 r11746  
    5858         * Called to execute the commands in the other thread
    5959         */
    60         protected void play(URL url, double offset, double speed) throws Exception {
     60        protected void play(URL url, double offset, double speed) throws InterruptedException, IOException {
    6161            this.url = url;
    6262            this.offset = offset;
     
    6767        }
    6868
    69         protected void pause() throws Exception {
     69        protected void pause() throws InterruptedException, IOException {
    7070            command = Command.PAUSE;
    7171            send();
    7272        }
    7373
    74         private void send() throws Exception {
     74        private void send() throws InterruptedException, IOException {
    7575            result = Result.WAITING;
    7676            interrupt();
     
    7979            }
    8080            if (result == Result.FAILED)
    81                 throw exception;
     81                throw new IOException(exception);
    8282        }
    8383
     
    121121     * start at the beginning of the stream
    122122     * @param url The resource to play, which must be a WAV file or stream
    123      * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format
    124      */
    125     public static void play(URL url) throws Exception {
     123     * @throws InterruptedException thread interrupted
     124     * @throws IOException audio fault exception, e.g. can't open stream, unhandleable audio format
     125     */
     126    public static void play(URL url) throws InterruptedException, IOException {
    126127        AudioPlayer instance = AudioPlayer.getInstance();
    127128        if (instance != null)
     
    133134     * @param url The resource to play, which must be a WAV file or stream
    134135     * @param seconds The number of seconds into the audio to start playing
    135      * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format
    136      */
    137     public static void play(URL url, double seconds) throws Exception {
     136     * @throws InterruptedException thread interrupted
     137     * @throws IOException audio fault exception, e.g. can't open stream, unhandleable audio format
     138     */
     139    public static void play(URL url, double seconds) throws InterruptedException, IOException {
    138140        AudioPlayer instance = AudioPlayer.getInstance();
    139141        if (instance != null)
     
    146148     * @param seconds The number of seconds into the audio to start playing
    147149     * @param speed Rate at which audio playes (1.0 = real time, > 1 is faster)
    148      * @throws Exception audio fault exception, e.g. can't open stream,  unhandleable audio format
    149      */
    150     public static void play(URL url, double seconds, double speed) throws Exception {
     150     * @throws InterruptedException thread interrupted
     151     * @throws IOException audio fault exception, e.g. can't open stream,  unhandleable audio format
     152     */
     153    public static void play(URL url, double seconds, double speed) throws InterruptedException, IOException {
    151154        AudioPlayer instance = AudioPlayer.getInstance();
    152155        if (instance != null)
     
    156159    /**
    157160     * Pauses the currently playing audio stream. Does nothing if nothing playing.
    158      * @throws Exception audio fault exception, e.g. can't open stream,  unhandleable audio format
    159      */
    160     public static void pause() throws Exception {
     161     * @throws InterruptedException thread interrupted
     162     * @throws IOException audio fault exception, e.g. can't open stream,  unhandleable audio format
     163     */
     164    public static void pause() throws InterruptedException, IOException {
    161165        AudioPlayer instance = AudioPlayer.getInstance();
    162166        if (instance != null)
     
    220224            audioPlayer = new AudioPlayer();
    221225            return audioPlayer;
    222         } catch (RuntimeException ex) {
     226        } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException ex) {
    223227            Main.error(ex);
    224228            return null;
     
    233237            try {
    234238                pause();
    235             } catch (Exception e) {
     239            } catch (InterruptedException | IOException e) {
    236240                Main.warn(e);
    237241            }
  • trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java

    r11620 r11746  
    8282                        z == null ? 18 : Integer.parseInt(z));
    8383            }
    84         } catch (NumberFormatException | NullPointerException | ArrayIndexOutOfBoundsException ex) {
     84        } catch (NumberFormatException | ArrayIndexOutOfBoundsException ex) {
    8585            Main.error(ex);
    8686        }
  • trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java

    r11381 r11746  
    194194                       "Cannot restore window geometry from preferences.",
    195195                            preferenceKey, field, v), e);
    196         } catch (RuntimeException e) {
     196        } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) {
    197197            throw new WindowGeometryException(
    198198                    tr("Failed to parse field ''{1}'' in preference with key ''{0}''. Exception was: {2}. " +
  • trunk/src/org/openstreetmap/josm/tools/bugreport/BugReport.java

    r10902 r11746  
    126126            try {
    127127                out.println(ShowStatusReportAction.getReportHeader());
    128             } catch (RuntimeException e) {
     128            } catch (RuntimeException e) { // NOPMD
    129129                out.println("Could not generate status report: " + e.getMessage());
    130130            }
  • trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportDialog.java

    r11196 r11746  
    222222                current = current.getParent();
    223223            }
    224         } catch (RuntimeException e) {
     224        } catch (RuntimeException e) { // NOPMD
    225225            BugReport.intercept(e).put("current", current).warn();
    226226        }
  • trunk/src/org/openstreetmap/josm/tools/bugreport/ReportedException.java

    r11739 r11746  
    6666        try {
    6767            BugReportQueue.getInstance().submit(this);
    68         } catch (RuntimeException e) {
     68        } catch (RuntimeException e) { // NOPMD
    6969            e.printStackTrace();
    7070        }
     
    218218                string = value.toString();
    219219            }
    220         } catch (RuntimeException t) {
     220        } catch (RuntimeException t) { // NOPMD
    221221            Main.warn(t);
    222222            string = "<Error calling toString()>";
Note: See TracChangeset for help on using the changeset viewer.