diff options
author | Godin <mandrikov@gmail.com> | 2010-12-07 10:47:02 +0000 |
---|---|---|
committer | Godin <mandrikov@gmail.com> | 2010-12-07 10:47:02 +0000 |
commit | a02e4a3754fd80a0ee47fa1349e017d1da1aec59 (patch) | |
tree | fb596731416ef28f5b27da40941bc4aa8b32b379 /sonar-ws-client/src/main/java/org/sonar/wsclient | |
parent | 1eec109f39f6cb356da0b81bb2c312caea451ccb (diff) | |
download | sonarqube-a02e4a3754fd80a0ee47fa1349e017d1da1aec59.tar.gz sonarqube-a02e4a3754fd80a0ee47fa1349e017d1da1aec59.zip |
SONAR-2024: Fix operations with generic types
Diffstat (limited to 'sonar-ws-client/src/main/java/org/sonar/wsclient')
7 files changed, 23 insertions, 21 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/Sonar.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/Sonar.java index 22acd92d2f4..99cd619b958 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/Sonar.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/Sonar.java @@ -76,7 +76,7 @@ public class Sonar { return result; } - public void delete(DeleteQuery query) { + public void delete(DeleteQuery<?> query) { connector.execute(query); } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/Connector.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/Connector.java index f6c7f1477b3..48599874db4 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/Connector.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/Connector.java @@ -34,18 +34,18 @@ public abstract class Connector { * @return JSON response or null if 404 NOT FOUND error * @throws ConnectionException if connection error or HTTP status not in (200, 404) */ - public abstract String execute(Query query); + public abstract String execute(Query<?> query); /** * @return JSON response or null if 404 NOT FOUND error * @since 2.2 */ - public abstract String execute(CreateQuery query); + public abstract String execute(CreateQuery<?> query); /** * @return JSON response or null if 404 NOT FOUND error * @since 2.2 */ - public abstract String execute(DeleteQuery query); + public abstract String execute(DeleteQuery<?> query); } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java index da660d1eb27..e3b2619549e 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java @@ -77,15 +77,15 @@ public class HttpClient3Connector extends Connector { } } - public String execute(Query query) { + public String execute(Query<?> query) { return executeRequest(newGetRequest(query)); } - public String execute(CreateQuery query) { + public String execute(CreateQuery<?> query) { return executeRequest(newPostRequest(query)); } - public String execute(DeleteQuery query) { + public String execute(DeleteQuery<?> query) { return executeRequest(newDeleteRequest(query)); } @@ -114,7 +114,7 @@ public class HttpClient3Connector extends Connector { return json; } - private HttpMethodBase newGetRequest(Query query) { + private HttpMethodBase newGetRequest(Query<?> query) { try { String url = server.getHost() + URIUtil.encodeQuery(query.getUrl()); HttpMethodBase method = new GetMethod(url); @@ -126,7 +126,7 @@ public class HttpClient3Connector extends Connector { } } - private HttpMethodBase newPostRequest(CreateQuery query) { + private HttpMethodBase newPostRequest(CreateQuery<?> query) { try { String url = server.getHost() + URIUtil.encodeQuery(query.getUrl()); HttpMethodBase method = new PostMethod(url); @@ -138,7 +138,7 @@ public class HttpClient3Connector extends Connector { } } - private HttpMethodBase newDeleteRequest(DeleteQuery query) { + private HttpMethodBase newDeleteRequest(DeleteQuery<?> query) { try { String url = server.getHost() + URIUtil.encodeQuery(query.getUrl()); HttpMethodBase method = new DeleteMethod(url); diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java index 73d1d15630f..9bb556cf5fa 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java @@ -53,15 +53,15 @@ public class HttpClient4Connector extends Connector { this.server = server; } - public String execute(Query query) { + public String execute(Query<?> query) { return executeRequest(newGetMethod(query)); } - public String execute(CreateQuery query) { + public String execute(CreateQuery<?> query) { return executeRequest(newPostMethod(query)); } - public String execute(DeleteQuery query) { + public String execute(DeleteQuery<?> query) { return executeRequest(newDeleteMethod(query)); } @@ -116,19 +116,19 @@ public class HttpClient4Connector extends Connector { return localcontext; } - private HttpGet newGetMethod(Query query) { + private HttpGet newGetMethod(Query<?> query) { HttpGet get = new HttpGet(server.getHost() + query.getUrl()); setJsonHeader(get); return get; } - private HttpDelete newDeleteMethod(DeleteQuery query) { + private HttpDelete newDeleteMethod(DeleteQuery<?> query) { HttpDelete delete = new HttpDelete(server.getHost() + query.getUrl()); setJsonHeader(delete); return delete; } - private HttpPost newPostMethod(CreateQuery query) { + private HttpPost newPostMethod(CreateQuery<?> query) { HttpPost post = new HttpPost(server.getHost() + query.getUrl()); setJsonHeader(post); return post; @@ -145,7 +145,7 @@ public class HttpClient4Connector extends Connector { AuthState authState = (AuthState) context.getAttribute(ClientContext.TARGET_AUTH_STATE); - // If no auth scheme avaialble yet, try to initialize it preemptively + // If no auth scheme available yet, try to initialize it preemptively if (authState.getAuthScheme() == null) { AuthScheme authScheme = (AuthScheme) context.getAttribute("preemptive-auth"); CredentialsProvider credsProvider = (CredentialsProvider) context.getAttribute(ClientContext.CREDS_PROVIDER); @@ -164,4 +164,4 @@ public class HttpClient4Connector extends Connector { } } } -}
\ No newline at end of file +} diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/FavouriteDeleteQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/FavouriteDeleteQuery.java index 00af7895cd3..f11702f587d 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/FavouriteDeleteQuery.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/FavouriteDeleteQuery.java @@ -19,7 +19,7 @@ */ package org.sonar.wsclient.services; -public class FavouriteDeleteQuery extends DeleteQuery { +public class FavouriteDeleteQuery extends DeleteQuery<Favourite> { private String idOrKey; diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/UserPropertyDeleteQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/UserPropertyDeleteQuery.java index 1f4defd58b2..4d3a3161539 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/UserPropertyDeleteQuery.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/UserPropertyDeleteQuery.java @@ -22,7 +22,7 @@ package org.sonar.wsclient.services; /** * @since 2.2 */ -public class UserPropertyDeleteQuery extends DeleteQuery { +public class UserPropertyDeleteQuery extends DeleteQuery<Property> { private String key; diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/JsonUtils.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/JsonUtils.java index 598812dc7e7..1df2dded901 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/JsonUtils.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/JsonUtils.java @@ -24,6 +24,8 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; +// Godin: we will use raw types here, because typically JSONObject passed as an argument +@SuppressWarnings("rawtypes") public final class JsonUtils { private JsonUtils() { @@ -49,7 +51,7 @@ public final class JsonUtils { public static Boolean getBoolean(Map obj, String field) { Object value = obj.get(field); if (value != null) { - return (Boolean)value; + return (Boolean) value; } return null; } |