summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2015-05-22 13:58:02 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-05-22 13:58:02 +0000
commit47acc4b4f4f7f15641044126a48028fbb0018350 (patch)
tree141ede5a03e868627100083bd41205ba0375e8f1
parentb8ba8dbc906eda2d5ae35846d50bc9414a6ac7d6 (diff)
parenta4b5f739f5203d4f8c327a2670e427510e5867ef (diff)
downloadandroid_frameworks_ex-47acc4b4f4f7f15641044126a48028fbb0018350.tar.gz
android_frameworks_ex-47acc4b4f4f7f15641044126a48028fbb0018350.tar.bz2
android_frameworks_ex-47acc4b4f4f7f15641044126a48028fbb0018350.zip
Merge "Use try-with-resources instead of Closeables.closeQuietly(Closeable)"
-rw-r--r--variablespeed/tests/src/com/android/ex/variablespeed/MediaPlayerProxyTestCase.java12
1 files changed, 2 insertions, 10 deletions
diff --git a/variablespeed/tests/src/com/android/ex/variablespeed/MediaPlayerProxyTestCase.java b/variablespeed/tests/src/com/android/ex/variablespeed/MediaPlayerProxyTestCase.java
index 37a0cce..035e238 100644
--- a/variablespeed/tests/src/com/android/ex/variablespeed/MediaPlayerProxyTestCase.java
+++ b/variablespeed/tests/src/com/android/ex/variablespeed/MediaPlayerProxyTestCase.java
@@ -16,8 +16,6 @@
package com.android.ex.variablespeed;
-import com.google.common.io.Closeables;
-
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.res.AssetManager;
@@ -532,17 +530,11 @@ public abstract class MediaPlayerProxyTestCase extends InstrumentationTestCase {
Uri uri = getContentResolver().insert(
VoicemailContract.Voicemails.buildSourceUri(packageName), values);
AssetManager assets = getAssets();
- OutputStream outputStream = null;
- InputStream inputStream = null;
- try {
- inputStream = assets.open(assetFilename);
- outputStream = getContentResolver().openOutputStream(uri);
+ try (InputStream inputStream = assets.open(assetFilename);
+ OutputStream outputStream = getContentResolver().openOutputStream(uri)) {
copyBetweenStreams(inputStream, outputStream);
mContentUriMap.put(key, uri);
return uri;
- } finally {
- Closeables.closeQuietly(outputStream);
- Closeables.closeQuietly(inputStream);
}
}