Source:
private static void download(RequestKey key, Context context) { HttpURLConnection connection = null; InputStream stream = null; Exception error = null; Bitmap bitmap = null; boolean issueResponse = true; try { URL url = new URL(key.uri.toString()); connection = (HttpURLConnection) url.openConnection(); connection.setInstanceFollowRedirects(false); switch (connection.getResponseCode()) { case HttpURLConnection.HTTP_MOVED_PERM: case HttpURLConnection.HTTP_MOVED_TEMP: issueResponse = false; String redirectLocation = connection.getHeaderField("location"); if (!Utility.isNullOrEmpty(redirectLocation)) { URI redirectUri = new URI(redirectLocation); UrlRedirectCache.cacheUriRedirect(context, key.uri, redirectUri); DownloaderContext downloaderContext = removePendingRequest(key); if (downloaderContext != null && !downloaderContext.isCancelled) { enqueueCacheRead( downloaderContext.request, new RequestKey(redirectUri, key.tag), false); } } break; case HttpURLConnection.HTTP_OK: stream = ImageResponseCache.interceptAndCacheImageStream(context, connection); bitmap = BitmapFactory.decodeStream(stream); break; default: stream = connection.getErrorStream(); if( stream != null ){ InputStreamReader reader = new InputStreamReader(stream); char[] buffer = new char[128]; int bufferLength; StringBuilder errorMessageBuilder = new StringBuilder(); while ((bufferLength = reader.read(buffer, 0, buffer.length)) > 0) { errorMessageBuilder.append(buffer, 0, bufferLength); } Utility.closeQuietly(reader); error = new FacebookException(errorMessageBuilder.toString()); } break; } } catch (IOException e) { error = e; } catch (URISyntaxException e) { error = e; } finally { Utility.closeQuietly(stream); Utility.disconnectQuietly(connection); } if (issueResponse) { issueResponse(key, error, bitmap, false); } }

Target:
private static void download(RequestKey key, Context context) { HttpURLConnection connection = null; InputStream stream = null; Exception error = null; Bitmap bitmap = null; boolean issueResponse = true; try { URL url = new URL(key.uri.toString()); connection = (HttpURLConnection) url.openConnection(); connection.setInstanceFollowRedirects(false); switch (connection.getResponseCode()) { case HttpURLConnection.HTTP_MOVED_PERM: case HttpURLConnection.HTTP_MOVED_TEMP: issueResponse = false; String redirectLocation = connection.getHeaderField("location"); if (!Utility.isNullOrEmpty(redirectLocation)) { URI redirectUri = new URI(redirectLocation); UrlRedirectCache.cacheUriRedirect(context, key.uri, redirectUri); DownloaderContext downloaderContext = removePendingRequest(key); if (downloaderContext != null && !downloaderContext.isCancelled) { enqueueCacheRead( downloaderContext.request, new RequestKey(redirectUri, key.tag), false); } } break; case HttpURLConnection.HTTP_OK: stream = ImageResponseCache.interceptAndCacheImageStream(context, connection); bitmap = BitmapFactory.decodeStream(stream); break; default: stream = connection.getErrorStream(); if (stream != null){ InputStreamReader reader = new InputStreamReader(stream); char[] buffer = new char[128]; int bufferLength; StringBuilder errorMessageBuilder = new StringBuilder(); while ((bufferLength = reader.read(buffer, 0, buffer.length)) > 0) { errorMessageBuilder.append(buffer, 0, bufferLength); } Utility.closeQuietly(reader); error = new FacebookException(errorMessageBuilder.toString()); } else { error = new FacebookException(R.string.com_facebook_image_download_unknown_error); } break; } } catch (IOException e) { error = e; } catch (URISyntaxException e) { error = e; } finally { Utility.closeQuietly(stream); Utility.disconnectQuietly(connection); } if (issueResponse) { issueResponse(key, error, bitmap, false); } }