diff --git a/vitamio-sample/src/io/vov/vitamio/demo/MediaMetadataRetrieverDemo.java b/vitamio-sample/src/io/vov/vitamio/demo/MediaMetadataRetrieverDemo.java index f60c065..c731b5f 100644 --- a/vitamio-sample/src/io/vov/vitamio/demo/MediaMetadataRetrieverDemo.java +++ b/vitamio-sample/src/io/vov/vitamio/demo/MediaMetadataRetrieverDemo.java @@ -39,11 +39,7 @@ protected void onCreate(Bundle savedInstanceState) { return; } retriever.setDataSource(path); - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } catch (IllegalStateException e) { - e.printStackTrace(); - } catch (IOException e) { + }catch(IllegalArgumentException | IllegalStateException | IOException e) /*multi-catch refactor*/ { e.printStackTrace(); } long durationMs = Long.parseLong(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION)); diff --git a/vitamio-sample/src/io/vov/vitamio/demo/MediaPlayerDemo_Audio.java b/vitamio-sample/src/io/vov/vitamio/demo/MediaPlayerDemo_Audio.java index 590e757..1827d68 100644 --- a/vitamio-sample/src/io/vov/vitamio/demo/MediaPlayerDemo_Audio.java +++ b/vitamio-sample/src/io/vov/vitamio/demo/MediaPlayerDemo_Audio.java @@ -84,7 +84,7 @@ private void playAudio(Integer media) { } tx.setText("Playing audio..."); - } catch (Exception e) { + }catch (Exception e) { Log.e(TAG, "error: " + e.getMessage(), e); } @@ -98,13 +98,7 @@ public MediaPlayer createMediaPlayer(Context context, int resid) { afd.close(); mp.prepare(); return mp; - } catch (IOException ex) { - Log.d(TAG, "create failed:", ex); - // fall through - } catch (IllegalArgumentException ex) { - Log.d(TAG, "create failed:", ex); - // fall through - } catch (SecurityException ex) { + }catch(IOException | IllegalArgumentException | SecurityException ex) /*multi-catch refactor*/ { Log.d(TAG, "create failed:", ex); // fall through } diff --git a/vitamio-sample/src/io/vov/vitamio/demo/MediaPlayerSubtitle.java b/vitamio-sample/src/io/vov/vitamio/demo/MediaPlayerSubtitle.java index a19a3d6..42b9ad9 100644 --- a/vitamio-sample/src/io/vov/vitamio/demo/MediaPlayerSubtitle.java +++ b/vitamio-sample/src/io/vov/vitamio/demo/MediaPlayerSubtitle.java @@ -70,16 +70,7 @@ private void playVideo() { mediaPlayer.setOnTimedTextListener(this); // TODO Auto-generated catch block - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalStateException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { + }catch(IllegalArgumentException | IllegalStateException | SecurityException | IOException e) /*multi-catch refactor*/ { // TODO Auto-generated catch block e.printStackTrace(); } diff --git a/vitamio/src/io/vov/vitamio/provider/MediaStore.java b/vitamio/src/io/vov/vitamio/provider/MediaStore.java index 94cd38b..d272071 100644 --- a/vitamio/src/io/vov/vitamio/provider/MediaStore.java +++ b/vitamio/src/io/vov/vitamio/provider/MediaStore.java @@ -210,11 +210,7 @@ private static Bitmap getMiniThumbFromFile(Cursor c, Uri baseUri, ContentResolve ParcelFileDescriptor pfdInput = cr.openFileDescriptor(thumbUri, "r"); bitmap = BitmapFactory.decodeFileDescriptor(pfdInput.getFileDescriptor(), null, options); pfdInput.close(); - } catch (FileNotFoundException ex) { - Log.e("getMiniThumbFromFile", ex); - } catch (IOException ex) { - Log.e("getMiniThumbFromFile", ex); - } catch (OutOfMemoryError ex) { + }catch(FileNotFoundException | IOException | OutOfMemoryError ex) /*multi-catch refactor*/ { Log.e("getMiniThumbFromFile", ex); } return bitmap; diff --git a/vitamio/src/io/vov/vitamio/widget/VideoView.java b/vitamio/src/io/vov/vitamio/widget/VideoView.java index b3f145a..cea7b2f 100644 --- a/vitamio/src/io/vov/vitamio/widget/VideoView.java +++ b/vitamio/src/io/vov/vitamio/widget/VideoView.java @@ -426,13 +426,7 @@ private void openVideo() { mMediaPlayer.prepareAsync(); mCurrentState = STATE_PREPARING; attachMediaController(); - } catch (IOException ex) { - Log.e("Unable to open content: " + mUri, ex); - mCurrentState = STATE_ERROR; - mTargetState = STATE_ERROR; - mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); - return; - } catch (IllegalArgumentException ex) { + }catch(IOException | IllegalArgumentException ex) /*multi-catch refactor*/ { Log.e("Unable to open content: " + mUri, ex); mCurrentState = STATE_ERROR; mTargetState = STATE_ERROR;