5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-06 21:23:03 +08:00

SQOOP-2452: Sqoop2: Findbugs: Convert anonymous class in ResourceRequest to static inner class

(Jarek Jarcec Cecho via Abraham Elmahrek)
This commit is contained in:
Abraham Elmahrek 2015-07-29 18:47:09 -07:00
parent 51fe7a9bc1
commit 3c88f553de

View File

@ -183,6 +183,13 @@ public String delete(String url) {
return doHttpRequest(url, HttpMethod.DELETE); return doHttpRequest(url, HttpMethod.DELETE);
} }
private static class SimpleConnectionConfigurator implements ConnectionConfigurator {
@Override
public HttpURLConnection configure(HttpURLConnection conn) throws IOException {
return conn;
}
}
public Token<?>[] addDelegationTokens(String strURL, String renewer, public Token<?>[] addDelegationTokens(String strURL, String renewer,
Credentials credentials) throws IOException { Credentials credentials) throws IOException {
Token<?>[] tokens = null; Token<?>[] tokens = null;
@ -190,13 +197,7 @@ public Token<?>[] addDelegationTokens(String strURL, String renewer,
Token<?> token = credentials.getToken(dtService); Token<?> token = credentials.getToken(dtService);
if (token == null) { if (token == null) {
URL url = new URL(strURL); URL url = new URL(strURL);
DelegationTokenAuthenticatedURL authUrl = DelegationTokenAuthenticatedURL authUrl = new DelegationTokenAuthenticatedURL(new SimpleConnectionConfigurator());
new DelegationTokenAuthenticatedURL(new ConnectionConfigurator() {
@Override
public HttpURLConnection configure(HttpURLConnection conn) throws IOException {
return conn;
}
});
try { try {
token = authUrl.getDelegationToken(url, authToken, renewer); token = authUrl.getDelegationToken(url, authToken, renewer);
if (token != null) { if (token != null) {