未验证 提交 37d886ef 编写于 作者: S Stanislav Baranov 提交者: GitHub

Simplify rollback of dynamic patches (#7432)

上级 6071286e
......@@ -104,26 +104,23 @@ public final class ResourceUpdater {
connection.setIfModifiedSince(lastDownloadTime);
}
try (InputStream input = connection.getInputStream()) {
URL resolvedURL = connection.getURL();
Log.i(TAG, "Resolved update URL " + resolvedURL);
if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
if (resolvedURL.equals(unresolvedURL)) {
Log.i(TAG, "Rolled back all updates");
localFile.delete();
return null;
} else {
int responseCode = connection.getResponseCode();
Log.i(TAG, "HTTP response code " + responseCode);
if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) {
Log.i(TAG, "Latest update not found");
return null;
}
}
if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) {
if (responseCode == HttpURLConnection.HTTP_NOT_MODIFIED) {
Log.i(TAG, "Already have latest update");
return null;
}
try (InputStream input = connection.getInputStream()) {
Log.i(TAG, "Downloading update " + unresolvedURL);
try (OutputStream output = new FileOutputStream(localFile)) {
int count;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册