Commit 77715fbf by andrewlewis Committed by Oliver Woodman

Fix some analysis warnings.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139901449
parent e84fa583
......@@ -48,5 +48,5 @@ dependencies {
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestCompile 'org.mockito:mockito-core:1.9.5'
androidTestCompile project(':library')
androidTestCompile 'com.android.support.test:runner:0.4'
androidTestCompile 'com.android.support.test:runner:0.5'
}
......@@ -57,7 +57,7 @@ dependencies {
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestCompile 'org.mockito:mockito-core:1.9.5'
compile 'com.android.support:support-annotations:24.2.1'
compile 'com.android.support:support-annotations:25.0.1'
}
android.libraryVariants.all { variant ->
......
......@@ -110,8 +110,8 @@ public final class DefaultOggSeekerTest extends TestCase {
long granuleDiff = currentGranule - targetGranule;
if ((granuleDiff > DefaultOggSeeker.MATCH_RANGE || granuleDiff < 0)
&& positionDiff > DefaultOggSeeker.MATCH_BYTE_RANGE) {
fail(String.format("granuleDiff (%d) or positionDiff (%d) is more than allowed.",
granuleDiff, positionDiff));
fail("granuleDiff (" + granuleDiff + ") or positionDiff (" + positionDiff
+ ") is more than allowed.");
}
}
}
......
......@@ -28,7 +28,7 @@ import junit.framework.TestCase;
*/
public class DefaultOggSeekerUtilMethodsTest extends TestCase {
private Random random = new Random(0);
private final Random random = new Random(0);
public void testSkipToNextPage() throws Exception {
FakeExtractorInput extractorInput = TestData.createInput(
......
......@@ -25,16 +25,16 @@ import junit.framework.Assert;
*/
/* package */ final class OggTestFile {
public static final int MAX_PACKET_LENGTH = 2048;
public static final int MAX_SEGMENT_COUNT = 10;
public static final int MAX_GRANULES_IN_PAGE = 100000;
private static final int MAX_PACKET_LENGTH = 2048;
private static final int MAX_SEGMENT_COUNT = 10;
private static final int MAX_GRANULES_IN_PAGE = 100000;
byte[] data;
long lastGranule;
int packetCount;
int pageCount;
int firstPayloadPageSize;
long firstPayloadPageGranulePosition;
public final byte[] data;
public final long lastGranule;
public final int packetCount;
public final int pageCount;
public final int firstPayloadPageSize;
public final long firstPayloadPageGranulePosition;
private OggTestFile(byte[] data, long lastGranule, int packetCount, int pageCount,
int firstPayloadPageSize, long firstPayloadPageGranulePosition) {
......
......@@ -31,7 +31,6 @@ import com.google.android.exoplayer2.testutil.FakeTrackOutput;
import com.google.android.exoplayer2.testutil.TestUtil;
import com.google.android.exoplayer2.util.ParsableByteArray;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Random;
/**
......@@ -114,7 +113,7 @@ public final class TsExtractorTest extends InstrumentationTestCase {
assertEquals(1, factory.sdtReader.consumedSdts);
}
private static void writeJunkData(ByteArrayOutputStream out, int length) throws IOException {
private static void writeJunkData(ByteArrayOutputStream out, int length) {
for (int i = 0; i < length; i++) {
if (((byte) i) == TS_SYNC_BYTE) {
out.write(0);
......
......@@ -97,7 +97,7 @@ public final class Mp4WebvttDecoderTest extends TestCase {
public void testNoCueSample() throws SubtitleDecoderException {
Mp4WebvttDecoder decoder = new Mp4WebvttDecoder();
Subtitle result = decoder.decode(NO_CUE_SAMPLE, NO_CUE_SAMPLE.length);
assertMp4WebvttSubtitleEquals(result, new Cue[0]);
assertMp4WebvttSubtitleEquals(result);
}
// Negative tests.
......
......@@ -28,7 +28,7 @@ public class CachedContentIndexTest extends InstrumentationTestCase {
0, 0, 0, 0, 0, 0, 0, 10, // original_content_length
0, 0, 0, 2, // cache_id
0, 5, 75, 76, 77, 78, 79, // cache_key
0, 0, 0, 0, 0, 0, 10, 00, // original_content_length
0, 0, 0, 0, 0, 0, 10, 0, // original_content_length
(byte) 0xF6, (byte) 0xFB, 0x50, 0x41 // hashcode_of_CachedContent_array
};
private CachedContentIndex index;
......
......@@ -69,10 +69,12 @@ public class AtomicFileTest extends InstrumentationTestCase {
output.write(6);
assertRead();
output.close();
output = atomicFile.startWrite();
assertRead();
output.close();
}
private void assertRead() throws IOException {
......
......@@ -447,15 +447,15 @@ public class StreamingDrmSessionManager<T extends ExoMediaCrypto> implements Drm
switch (msg.what) {
case MediaDrm.EVENT_KEY_REQUIRED:
postKeyRequest();
return;
break;
case MediaDrm.EVENT_KEY_EXPIRED:
state = STATE_OPENED;
onError(new KeysExpiredException());
return;
break;
case MediaDrm.EVENT_PROVISION_REQUIRED:
state = STATE_OPENED;
postProvisionRequest();
return;
break;
}
}
......@@ -483,10 +483,10 @@ public class StreamingDrmSessionManager<T extends ExoMediaCrypto> implements Drm
switch (msg.what) {
case MSG_PROVISION:
onProvisionResponse(msg.obj);
return;
break;
case MSG_KEYS:
onKeyResponse(msg.obj);
return;
break;
}
}
......
......@@ -369,22 +369,22 @@ public final class Cea608Decoder extends CeaDecoder {
if (captionMode == CC_MODE_ROLL_UP || captionMode == CC_MODE_PAINT_ON) {
captionStringBuilder.setLength(0);
}
return;
break;
case CTRL_ERASE_NON_DISPLAYED_MEMORY:
captionStringBuilder.setLength(0);
return;
break;
case CTRL_END_OF_CAPTION:
captionString = getDisplayCaption();
captionStringBuilder.setLength(0);
return;
break;
case CTRL_CARRIAGE_RETURN:
maybeAppendNewline();
return;
break;
case CTRL_BACKSPACE:
if (captionStringBuilder.length() > 0) {
captionStringBuilder.setLength(captionStringBuilder.length() - 1);
}
return;
break;
}
}
......
......@@ -113,8 +113,8 @@ public final class ParsingLoadable<T> implements Loadable {
inputStream.open();
result = parser.parse(dataSource.getUri(), inputStream);
} finally {
inputStream.close();
bytesLoaded = inputStream.bytesRead();
inputStream.close();
}
}
......
......@@ -354,10 +354,7 @@ public final class SimpleCache implements Cache {
@Override
public synchronized boolean isCached(String key, long position, long length) {
CachedContent cachedContent = index.get(key);
if (cachedContent == null) {
return false;
}
return cachedContent.isCached(position, length);
return cachedContent != null && cachedContent.isCached(position, length);
}
@Override
......
......@@ -98,7 +98,7 @@ public final class AtomicFile {
baseName.delete();
}
}
OutputStream str = null;
OutputStream str;
try {
str = new AtomicFileOutputStream(baseName);
} catch (FileNotFoundException e) {
......
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