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

PMD - Strict Exceptions

File:
1 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            }
Note: See TracChangeset for help on using the changeset viewer.