Commit a3891f6f by reudismam

Use the pattern ''string literal''.equals(something) to prevent NPE as it is…

Use the pattern ''string literal''.equals(something) to prevent NPE as it is done in many other locations in the codebase.
parent 23ff4efd
......@@ -48,7 +48,7 @@ public class DemoApplication extends Application {
}
public boolean useExtensionRenderers() {
return BuildConfig.FLAVOR.equals("withExtensions");
return "withExtensions".equals(BuildConfig.FLAVOR);
}
}
......@@ -354,15 +354,15 @@ public final class MediaCodecUtil {
// Work around https://github.com/google/ExoPlayer/issues/3249.
if (Util.SDK_INT < 24
&& ("OMX.SEC.aac.dec".equals(name) || "OMX.Exynos.AAC.Decoder".equals(name))
&& Util.MANUFACTURER.equals("samsung")
&& "samsung".equals(Util.MANUFACTURER)
&& (Util.DEVICE.startsWith("zeroflte") // Galaxy S6
|| Util.DEVICE.startsWith("zerolte") // Galaxy S6 Edge
|| Util.DEVICE.startsWith("zenlte") // Galaxy S6 Edge+
|| Util.DEVICE.equals("SC-05G") // Galaxy S6
|| Util.DEVICE.equals("marinelteatt") // Galaxy S6 Active
|| Util.DEVICE.equals("404SC") // Galaxy S6 Edge
|| Util.DEVICE.equals("SC-04G")
|| Util.DEVICE.equals("SCV31"))) {
|| "SC-05G".equals(Util.DEVICE) // Galaxy S6
|| "marinelteatt".equals(Util.DEVICE) // Galaxy S6 Active
|| "404SC".equals(Util.DEVICE) // Galaxy S6 Edge
|| "SC-04G".equals(Util.DEVICE)
|| "SCV31".equals(Util.DEVICE))) {
return false;
}
......@@ -421,7 +421,7 @@ public final class MediaCodecUtil {
*/
private static boolean codecNeedsDisableAdaptationWorkaround(String name) {
return Util.SDK_INT <= 22
&& (Util.MODEL.equals("ODROID-XU3") || Util.MODEL.equals("Nexus 10"))
&& ("ODROID-XU3".equals(Util.MODEL) || "Nexus 10".equals(Util.MODEL))
&& ("OMX.Exynos.AVC.Decoder".equals(name) || "OMX.Exynos.AVC.Decoder.secure".equals(name));
}
......
......@@ -529,7 +529,7 @@ public final class Id3Decoder implements MetadataDecoder {
if (majorVersion == 2) {
mimeTypeEndIndex = 2;
mimeType = "image/" + Util.toLowerInvariant(new String(data, 0, 3, "ISO-8859-1"));
if (mimeType.equals("image/jpg")) {
if ("image/jpg".equals(mimeType)) {
mimeType = "image/jpeg";
}
} else {
......
......@@ -613,9 +613,9 @@ public class DefaultHttpDataSource implements HttpDataSource {
return;
}
String className = inputStream.getClass().getName();
if (className.equals("com.android.okhttp.internal.http.HttpTransport$ChunkedInputStream")
|| className.equals(
"com.android.okhttp.internal.http.HttpTransport$FixedLengthInputStream")) {
if ("com.android.okhttp.internal.http.HttpTransport$ChunkedInputStream".equals(className)
|| "com.android.okhttp.internal.http.HttpTransport$FixedLengthInputStream".equals(
className)) {
Class<?> superclass = inputStream.getClass().getSuperclass();
Method unexpectedEndOfInput = superclass.getDeclaredMethod("unexpectedEndOfInput");
unexpectedEndOfInput.setAccessible(true);
......
......@@ -160,7 +160,7 @@ public final class Util {
*/
public static boolean isLocalFileUri(Uri uri) {
String scheme = uri.getScheme();
return TextUtils.isEmpty(scheme) || scheme.equals("file");
return TextUtils.isEmpty(scheme) || "file".equals(scheme);
}
/**
......@@ -629,7 +629,7 @@ public final class Util {
} else {
timezoneShift = ((Integer.parseInt(matcher.group(12)) * 60
+ Integer.parseInt(matcher.group(13))));
if (matcher.group(11).equals("-")) {
if ("-".equals(matcher.group(11))) {
timezoneShift *= -1;
}
}
......
......@@ -112,7 +112,7 @@ public class DashManifestParser extends DefaultHandler
long durationMs = parseDuration(xpp, "mediaPresentationDuration", C.TIME_UNSET);
long minBufferTimeMs = parseDuration(xpp, "minBufferTime", C.TIME_UNSET);
String typeString = xpp.getAttributeValue(null, "type");
boolean dynamic = typeString != null && typeString.equals("dynamic");
boolean dynamic = typeString != null && "dynamic".equals(typeString);
long minUpdateTimeMs = dynamic ? parseDuration(xpp, "minimumUpdatePeriod", C.TIME_UNSET)
: C.TIME_UNSET;
long timeShiftBufferDepthMs = dynamic
......
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