mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Refactor Guava functional methods to use lambdas
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=177027488
This commit is contained in:
parent
2ae496bfce
commit
bbe2584da4
47 changed files with 478 additions and 647 deletions
|
@ -27,7 +27,6 @@ import com.google.api.client.http.HttpHeaders;
|
|||
import com.google.api.client.http.HttpRequest;
|
||||
import com.google.api.client.http.HttpRequestFactory;
|
||||
import com.google.api.client.http.HttpResponse;
|
||||
import com.google.api.client.http.HttpUnsuccessfulResponseHandler;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
@ -98,20 +97,15 @@ class AppEngineConnection implements Connection {
|
|||
request.setFollowRedirects(false);
|
||||
request.setThrowExceptionOnExecuteError(false);
|
||||
request.setUnsuccessfulResponseHandler(
|
||||
new HttpUnsuccessfulResponseHandler() {
|
||||
@Override
|
||||
public boolean handleResponse(
|
||||
HttpRequest request, HttpResponse response, boolean supportsRetry)
|
||||
throws IOException {
|
||||
String errorTitle = extractHtmlTitle(getErrorHtmlAsString(response));
|
||||
throw new IOException(
|
||||
String.format(
|
||||
"Error from %s: %d %s%s",
|
||||
request.getUrl().toString(),
|
||||
response.getStatusCode(),
|
||||
response.getStatusMessage(),
|
||||
(errorTitle == null ? "" : ": " + errorTitle)));
|
||||
}
|
||||
(request1, response, supportsRetry) -> {
|
||||
String errorTitle = extractHtmlTitle(getErrorHtmlAsString(response));
|
||||
throw new IOException(
|
||||
String.format(
|
||||
"Error from %s: %d %s%s",
|
||||
request1.getUrl().toString(),
|
||||
response.getStatusCode(),
|
||||
response.getStatusMessage(),
|
||||
(errorTitle == null ? "" : ": " + errorTitle)));
|
||||
});
|
||||
HttpResponse response = null;
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue