Commit fa3d129b by eguven Committed by Oliver Woodman

Fix some of the issues pointed by android lint tool

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139915885
parent 61014503
...@@ -50,7 +50,7 @@ public class AtomicFileTest extends InstrumentationTestCase { ...@@ -50,7 +50,7 @@ public class AtomicFileTest extends InstrumentationTestCase {
assertFalse(file.exists()); assertFalse(file.exists());
} }
public void testWriteEndRead() throws Exception { public void testWriteRead() throws Exception {
OutputStream output = atomicFile.startWrite(); OutputStream output = atomicFile.startWrite();
output.write(5); output.write(5);
atomicFile.endWrite(output); atomicFile.endWrite(output);
......
...@@ -138,6 +138,7 @@ public final class CacheDataSink implements DataSink { ...@@ -138,6 +138,7 @@ public final class CacheDataSink implements DataSink {
outputStreamBytesWritten = 0; outputStreamBytesWritten = 0;
} }
@SuppressWarnings("ThrowFromFinallyBlock")
private void closeCurrentOutputStream() throws IOException { private void closeCurrentOutputStream() throws IOException {
if (outputStream == null) { if (outputStream == null) {
return; return;
...@@ -150,13 +151,14 @@ public final class CacheDataSink implements DataSink { ...@@ -150,13 +151,14 @@ public final class CacheDataSink implements DataSink {
success = true; success = true;
} finally { } finally {
Util.closeQuietly(outputStream); Util.closeQuietly(outputStream);
outputStream = null;
File fileToCommit = file;
file = null;
if (success) { if (success) {
cache.commitFile(file); cache.commitFile(fileToCommit);
} else { } else {
file.delete(); fileToCommit.delete();
} }
outputStream = null;
file = null;
} }
} }
......
...@@ -22,7 +22,7 @@ package com.google.android.exoplayer2.upstream.cache; ...@@ -22,7 +22,7 @@ package com.google.android.exoplayer2.upstream.cache;
public interface CacheEvictor extends Cache.Listener { public interface CacheEvictor extends Cache.Listener {
/** /**
* Called when cache has beeen initialized. * Called when cache has been initialized.
*/ */
void onCacheInitialized(); void onCacheInitialized();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment