Bug 1300543 - IconDownloader: Use final keyword where appropriate. r=ahunt

MozReview-Commit-ID: DhWIRPZf7rg

--HG--
extra : rebase_source : 797987c944e445a4ea7e00a2373c83c2003c0c1a
This commit is contained in:
Sebastian Kaspari 2016-09-06 13:58:35 +02:00
Родитель 58d250abaa
Коммит a5a657d556
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -56,7 +56,7 @@ public class IconDownloader implements IconLoader {
}
try {
LoadFaviconResult result = downloadAndDecodeImage(request.getContext(), iconUrl);
final LoadFaviconResult result = downloadAndDecodeImage(request.getContext(), iconUrl);
if (result == null) {
return null;
}
@ -90,7 +90,7 @@ public class IconDownloader implements IconLoader {
@VisibleForTesting
LoadFaviconResult downloadAndDecodeImage(Context context, String targetFaviconURL) throws IOException, URISyntaxException {
// Try the URL we were given.
HttpURLConnection connection = tryDownload(targetFaviconURL);
final HttpURLConnection connection = tryDownload(targetFaviconURL);
if (connection == null) {
return null;
}
@ -115,7 +115,7 @@ public class IconDownloader implements IconLoader {
* @return The HttpResponse containing the downloaded Favicon if successful, null otherwise.
*/
private HttpURLConnection tryDownload(String faviconURI) throws URISyntaxException, IOException {
HashSet<String> visitedLinkSet = new HashSet<>();
final HashSet<String> visitedLinkSet = new HashSet<>();
visitedLinkSet.add(faviconURI);
return tryDownloadRecurse(faviconURI, visitedLinkSet);
}
@ -128,10 +128,10 @@ public class IconDownloader implements IconLoader {
return null;
}
HttpURLConnection connection = connectTo(faviconURI);
final HttpURLConnection connection = connectTo(faviconURI);
// Was the response a failure?
int status = connection.getResponseCode();
final int status = connection.getResponseCode();
// Handle HTTP status codes requesting a redirect.
if (status >= 300 && status < 400) {
@ -169,7 +169,7 @@ public class IconDownloader implements IconLoader {
@VisibleForTesting
HttpURLConnection connectTo(String faviconURI) throws URISyntaxException, IOException {
HttpURLConnection connection = (HttpURLConnection) ProxySelector.openConnectionWithProxy(
final HttpURLConnection connection = (HttpURLConnection) ProxySelector.openConnectionWithProxy(
new URI(faviconURI));
connection.setRequestProperty("User-Agent", GeckoAppShell.getGeckoInterface().getDefaultUAString());
@ -197,7 +197,7 @@ public class IconDownloader implements IconLoader {
*/
private LoadFaviconResult decodeImageFromResponse(Context context, InputStream stream, int contentLength) throws IOException {
// This may not be provided, but if it is, it's useful.
int bufferSize;
final int bufferSize;
if (contentLength > 0) {
// The size was reported and sane, so let's use that.
// Integer overflow should not be a problem for Favicon sizes...
@ -208,7 +208,7 @@ public class IconDownloader implements IconLoader {
}
// Read the InputStream into a byte[].
IOUtils.ConsumedInputStream result = IOUtils.readFully(stream, bufferSize);
final IOUtils.ConsumedInputStream result = IOUtils.readFully(stream, bufferSize);
if (result == null) {
return null;
}