mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
代码优化,由IDEA自动进行的Code Cleanup
This commit is contained in:
@@ -14,7 +14,7 @@ public class InputStreamResponseHandler implements ResponseHandler<InputStream>
|
||||
|
||||
public static final ResponseHandler<InputStream> INSTANCE = new InputStreamResponseHandler();
|
||||
|
||||
public InputStream handleResponse(final HttpResponse response) throws HttpResponseException, IOException {
|
||||
public InputStream handleResponse(final HttpResponse response) throws IOException {
|
||||
final StatusLine statusLine = response.getStatusLine();
|
||||
final HttpEntity entity = response.getEntity();
|
||||
if (statusLine.getStatusCode() >= 300) {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class MediaDownloadRequestExecutor implements RequestExecutor<File, Strin
|
||||
|
||||
|
||||
@Override
|
||||
public File execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String queryParam) throws WxErrorException, ClientProtocolException, IOException {
|
||||
public File execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String queryParam) throws WxErrorException, IOException {
|
||||
if (queryParam != null) {
|
||||
if (uri.indexOf('?') == -1) {
|
||||
uri += '?';
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.io.IOException;
|
||||
public class MediaUploadRequestExecutor implements RequestExecutor<WxMediaUploadResult, File> {
|
||||
|
||||
@Override
|
||||
public WxMediaUploadResult execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, File file) throws WxErrorException, ClientProtocolException, IOException {
|
||||
public WxMediaUploadResult execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, File file) throws WxErrorException, IOException {
|
||||
HttpPost httpPost = new HttpPost(uri);
|
||||
if (httpProxy != null) {
|
||||
RequestConfig config = RequestConfig.custom().setProxy(httpProxy).build();
|
||||
|
||||
@@ -26,6 +26,6 @@ public interface RequestExecutor<T, E> {
|
||||
* @throws ClientProtocolException
|
||||
* @throws IOException
|
||||
*/
|
||||
public T execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, E data) throws WxErrorException, ClientProtocolException, IOException;
|
||||
T execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, E data) throws WxErrorException, IOException;
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.io.IOException;
|
||||
public class SimpleGetRequestExecutor implements RequestExecutor<String, String> {
|
||||
|
||||
@Override
|
||||
public String execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String queryParam) throws WxErrorException, ClientProtocolException, IOException {
|
||||
public String execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String queryParam) throws WxErrorException, IOException {
|
||||
if (queryParam != null) {
|
||||
if (uri.indexOf('?') == -1) {
|
||||
uri += '?';
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.io.IOException;
|
||||
public class SimplePostRequestExecutor implements RequestExecutor<String, String> {
|
||||
|
||||
@Override
|
||||
public String execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String postEntity) throws WxErrorException, ClientProtocolException, IOException {
|
||||
public String execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String postEntity) throws WxErrorException, IOException {
|
||||
HttpPost httpPost = new HttpPost(uri);
|
||||
if (httpProxy != null) {
|
||||
RequestConfig config = RequestConfig.custom().setProxy(httpProxy).build();
|
||||
|
||||
@@ -19,7 +19,7 @@ public class Utf8ResponseHandler implements ResponseHandler<String> {
|
||||
|
||||
public static final ResponseHandler<String> INSTANCE = new Utf8ResponseHandler();
|
||||
|
||||
public String handleResponse(final HttpResponse response) throws HttpResponseException, IOException {
|
||||
public String handleResponse(final HttpResponse response) throws IOException {
|
||||
final StatusLine statusLine = response.getStatusLine();
|
||||
final HttpEntity entity = response.getEntity();
|
||||
if (statusLine.getStatusCode() >= 300) {
|
||||
|
||||
@@ -91,7 +91,7 @@ public class GsonHelper {
|
||||
|
||||
public static boolean getAsPrimitiveBool(JsonElement element) {
|
||||
Boolean r = getAsBoolean(element);
|
||||
return r == null ? false : r.booleanValue();
|
||||
return r != null && r.booleanValue();
|
||||
}
|
||||
|
||||
public static Double getAsDouble(JsonElement element) {
|
||||
|
||||
@@ -211,10 +211,7 @@ public class StringManager {
|
||||
@Override
|
||||
protected boolean removeEldestEntry(
|
||||
Map.Entry<Locale,StringManager> eldest) {
|
||||
if (size() > (LOCALE_CACHE_SIZE - 1)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return size() > (LOCALE_CACHE_SIZE - 1);
|
||||
}
|
||||
};
|
||||
managers.put(packageName, map);
|
||||
|
||||
Reference in New Issue
Block a user