代码优化,由IDEA自动进行的Code Cleanup

This commit is contained in:
BinaryWang 2016-07-27 17:57:13 +08:00
parent 622e185203
commit 3d6778f83a
44 changed files with 140 additions and 156 deletions

View File

@ -7,6 +7,6 @@ import me.chanjar.weixin.common.exception.WxErrorException;
*/
public interface WxErrorExceptionHandler {
public void handle(WxErrorException e);
void handle(WxErrorException e);
}

View File

@ -22,6 +22,6 @@ public interface WxMessageDuplicateChecker {
* @param messageId messageId需要根据上面讲的方式构造
* @return 如果是重复消息返回true否则返回false
*/
public boolean isDuplicate(String messageId);
boolean isDuplicate(String messageId);
}

View File

@ -87,11 +87,7 @@ public class WxMessageInMemoryDuplicateChecker implements WxMessageDuplicateChec
}
checkBackgroundProcessStarted();
Long timestamp = msgId2Timestamp.putIfAbsent(messageId, System.currentTimeMillis());
if (timestamp == null) {
// 第一次接收到这个消息
return false;
}
return true;
return timestamp != null;
}

View File

@ -13,7 +13,7 @@ public interface InternalSession {
*
* @param isValid The new value for the <code>isValid</code> flag
*/
public void setValid(boolean isValid);
void setValid(boolean isValid);
/**
* Return the <code>isValid</code> flag for this session.

View File

@ -28,14 +28,14 @@ public interface InternalSessionManager {
* @exception IllegalStateException if a new session cannot be
* instantiated for any reason
*/
public InternalSession createSession(String sessionId);
InternalSession createSession(String sessionId);
/**
* Remove this Session from the active Sessions for this Manager.
*
* @param session Session to be removed
*/
public void remove(InternalSession session);
void remove(InternalSession session);
/**
* Remove this Session from the active Sessions for this Manager.
@ -43,7 +43,7 @@ public interface InternalSessionManager {
* @param session Session to be removed
* @param update Should the expiration statistics be updated
*/
public void remove(InternalSession session, boolean update);
void remove(InternalSession session, boolean update);
/**
* Add this Session to the set of active Sessions for this Manager.
@ -71,7 +71,7 @@ public interface InternalSessionManager {
/**
* Implements the Manager interface, direct call to processExpires
*/
public void backgroundProcess();
void backgroundProcess();
/**
* Set the default maximum inactive interval (in seconds)

View File

@ -323,9 +323,8 @@ public class StandardSession implements WxSession, InternalSession {
if (!attributes.equals(session.attributes)) return false;
if (!facade.equals(session.facade)) return false;
if (!id.equals(session.id)) return false;
if (!manager.equals(session.manager)) return false;
return manager.equals(session.manager);
return true;
}
@Override

View File

@ -4,14 +4,14 @@ import java.util.Enumeration;
public interface WxSession {
public Object getAttribute(String name);
Object getAttribute(String name);
public Enumeration<String> getAttributeNames();
Enumeration<String> getAttributeNames();
public void setAttribute(String name, Object value);
void setAttribute(String name, Object value);
public void removeAttribute(String name);
void removeAttribute(String name);
public void invalidate();
void invalidate();
}

View File

@ -5,12 +5,12 @@ public interface WxSessionManager {
/**
* 获取某个sessionId对应的session,如果sessionId没有对应的session则新建一个并返回
*/
public WxSession getSession(String sessionId);
WxSession getSession(String sessionId);
/**
* 获取某个sessionId对应的session,如果sessionId没有对应的session若create为true则新建一个否则返回null
*/
public WxSession getSession(String sessionId, boolean create);
WxSession getSession(String sessionId, boolean create);
}

View File

@ -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) {

View File

@ -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 += '?';

View File

@ -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();

View File

@ -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;
}

View File

@ -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 += '?';

View File

@ -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();

View File

@ -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) {

View File

@ -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) {

View File

@ -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);

View File

@ -12,61 +12,61 @@ import java.io.File;
*/
public interface WxCpConfigStorage {
public String getAccessToken();
String getAccessToken();
public boolean isAccessTokenExpired();
boolean isAccessTokenExpired();
/**
* 强制将access token过期掉
*/
public void expireAccessToken();
void expireAccessToken();
public void updateAccessToken(WxAccessToken accessToken);
void updateAccessToken(WxAccessToken accessToken);
public void updateAccessToken(String accessToken, int expiresIn);
void updateAccessToken(String accessToken, int expiresIn);
public String getJsapiTicket();
String getJsapiTicket();
public boolean isJsapiTicketExpired();
boolean isJsapiTicketExpired();
/**
* 强制将jsapi ticket过期掉
*/
public void expireJsapiTicket();
void expireJsapiTicket();
/**
* 应该是线程安全的
* @param jsapiTicket
*/
public void updateJsapiTicket(String jsapiTicket, int expiresInSeconds);
void updateJsapiTicket(String jsapiTicket, int expiresInSeconds);
public String getCorpId();
String getCorpId();
public String getCorpSecret();
String getCorpSecret();
public String getAgentId();
String getAgentId();
public String getToken();
String getToken();
public String getAesKey();
String getAesKey();
public long getExpiresTime();
long getExpiresTime();
public String getOauth2redirectUri();
String getOauth2redirectUri();
public String getHttp_proxy_host();
String getHttp_proxy_host();
public int getHttp_proxy_port();
int getHttp_proxy_port();
public String getHttp_proxy_username();
String getHttp_proxy_username();
public String getHttp_proxy_password();
String getHttp_proxy_password();
public File getTmpDirFile();
File getTmpDirFile();
/**
* http client builder
* @return ApacheHttpClientBuilder
*/
public ApacheHttpClientBuilder getApacheHttpClientBuilder();
ApacheHttpClientBuilder getApacheHttpClientBuilder();
}

View File

@ -22,7 +22,7 @@ public interface WxCpMessageHandler {
* @param sessionManager
* @return xml格式的消息如果在异步规则里处理的话可以返回null
*/
public WxCpXmlOutMessage handle(WxCpXmlMessage wxMessage,
WxCpXmlOutMessage handle(WxCpXmlMessage wxMessage,
Map<String, Object> context,
WxCpService wxCpService,
WxSessionManager sessionManager) throws WxErrorException;

View File

@ -22,7 +22,7 @@ public interface WxCpMessageInterceptor {
* @param sessionManager
* @return true代表OKfalse代表不OK
*/
public boolean intercept(WxCpXmlMessage wxMessage,
boolean intercept(WxCpXmlMessage wxMessage,
Map<String, Object> context,
WxCpService wxCpService,
WxSessionManager sessionManager) throws WxErrorException;

View File

@ -10,6 +10,6 @@ public interface WxCpMessageMatcher {
/**
* 消息是否匹配某种模式
*/
public boolean match(WxCpXmlMessage message);
boolean match(WxCpXmlMessage message);
}

View File

@ -210,10 +210,7 @@ public class WxCpMessageRouter {
messageId = String.valueOf(wxMessage.getMsgId());
}
if (messageDuplicateChecker.isDuplicate(messageId)) {
return true;
}
return false;
return messageDuplicateChecker.isDuplicate(messageId);
}

View File

@ -70,7 +70,7 @@ public interface WxCpService {
* @see #getJsapiTicket(boolean)
* @throws WxErrorException
*/
public String getJsapiTicket() throws WxErrorException;
String getJsapiTicket() throws WxErrorException;
/**
* <pre>
@ -82,7 +82,7 @@ public interface WxCpService {
* @param forceRefresh 强制刷新
* @throws WxErrorException
*/
public String getJsapiTicket(boolean forceRefresh) throws WxErrorException;
String getJsapiTicket(boolean forceRefresh) throws WxErrorException;
/**
* <pre>
@ -92,7 +92,7 @@ public interface WxCpService {
* </pre>
* @param url url
*/
public WxJsapiSignature createJsapiSignature(String url) throws WxErrorException;
WxJsapiSignature createJsapiSignature(String url) throws WxErrorException;
/**
* <pre>

View File

@ -49,7 +49,6 @@ public class WxCpMessageRouterTest {
}
}).handler(new WxEchoCpMessageHandler(sb, "matcher")).end()
.rule().async(async).handler(new WxEchoCpMessageHandler(sb, "ALL")).end();
;
}
@Test(dataProvider="messages-1")

View File

@ -13,89 +13,89 @@ import java.io.File;
*/
public interface WxMpConfigStorage {
public String getAccessToken();
String getAccessToken();
public boolean isAccessTokenExpired();
boolean isAccessTokenExpired();
/**
* 强制将access token过期掉
*/
public void expireAccessToken();
void expireAccessToken();
/**
* 应该是线程安全的
* @param accessToken
*/
public void updateAccessToken(WxAccessToken accessToken);
void updateAccessToken(WxAccessToken accessToken);
/**
* 应该是线程安全的
* @param accessToken
* @param expiresIn
*/
public void updateAccessToken(String accessToken, int expiresIn);
void updateAccessToken(String accessToken, int expiresIn);
public String getJsapiTicket();
String getJsapiTicket();
public boolean isJsapiTicketExpired();
boolean isJsapiTicketExpired();
/**
* 强制将jsapi ticket过期掉
*/
public void expireJsapiTicket();
void expireJsapiTicket();
/**
* 应该是线程安全的
* @param jsapiTicket
*/
public void updateJsapiTicket(String jsapiTicket, int expiresInSeconds);
void updateJsapiTicket(String jsapiTicket, int expiresInSeconds);
public String getCardApiTicket();
String getCardApiTicket();
public boolean isCardApiTicketExpired();
boolean isCardApiTicketExpired();
/**
* 强制将卡券api ticket过期掉
*/
public void expireCardApiTicket();
void expireCardApiTicket();
/**
* 应该是线程安全的
* @param cardApiTicket
*/
public void updateCardApiTicket(String cardApiTicket, int expiresInSeconds);
void updateCardApiTicket(String cardApiTicket, int expiresInSeconds);
public String getAppId();
String getAppId();
public String getSecret();
String getSecret();
public String getPartnerId();
String getPartnerId();
public String getPartnerKey();
String getPartnerKey();
public String getToken();
String getToken();
public String getAesKey();
String getAesKey();
public long getExpiresTime();
long getExpiresTime();
public String getOauth2redirectUri();
String getOauth2redirectUri();
public String getHttp_proxy_host();
String getHttp_proxy_host();
public int getHttp_proxy_port();
int getHttp_proxy_port();
public String getHttp_proxy_username();
String getHttp_proxy_username();
public String getHttp_proxy_password();
String getHttp_proxy_password();
public File getTmpDirFile();
File getTmpDirFile();
public SSLContext getSSLContext();
SSLContext getSSLContext();
/**
* http client builder
* @return ApacheHttpClientBuilder
*/
public ApacheHttpClientBuilder getApacheHttpClientBuilder();
ApacheHttpClientBuilder getApacheHttpClientBuilder();
}

View File

@ -22,7 +22,7 @@ public interface WxMpGroupService {
*
* @param name 分组名字30个字符以内
*/
public WxMpGroup groupCreate(String name) throws WxErrorException;
WxMpGroup groupCreate(String name) throws WxErrorException;
/**
* <pre>
@ -30,7 +30,7 @@ public interface WxMpGroupService {
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=分组管理接口
* </pre>
*/
public List<WxMpGroup> groupGet() throws WxErrorException;
List<WxMpGroup> groupGet() throws WxErrorException;
/**
* <pre>
@ -40,7 +40,7 @@ public interface WxMpGroupService {
*
* @param openid 微信用户的openid
*/
public long userGetGroup(String openid) throws WxErrorException;
long userGetGroup(String openid) throws WxErrorException;
/**
* <pre>
@ -52,7 +52,7 @@ public interface WxMpGroupService {
*
* @param group 要更新的groupgroup的id,name必须设置
*/
public void groupUpdate(WxMpGroup group) throws WxErrorException;
void groupUpdate(WxMpGroup group) throws WxErrorException;
/**
* <pre>
@ -65,5 +65,5 @@ public interface WxMpGroupService {
* @param openid 用户openid
* @param to_groupid 移动到的分组id
*/
public void userUpdateGroup(String openid, long to_groupid) throws WxErrorException;
void userUpdateGroup(String openid, long to_groupid) throws WxErrorException;
}

View File

@ -25,7 +25,7 @@ public interface WxMpMaterialService {
* @throws WxErrorException
* @see #mediaUpload(String, String, InputStream)
*/
public WxMediaUploadResult mediaUpload(String mediaType, File file) throws WxErrorException;
WxMediaUploadResult mediaUpload(String mediaType, File file) throws WxErrorException;
/**
* <pre>
@ -39,7 +39,7 @@ public interface WxMpMaterialService {
* @return 保存到本地的临时文件
* @throws WxErrorException
*/
public File mediaDownload(String media_id) throws WxErrorException;
File mediaDownload(String media_id) throws WxErrorException;
/**
* <pre>
@ -51,7 +51,7 @@ public interface WxMpMaterialService {
* @return WxMediaImgUploadResult 返回图片url
* @throws WxErrorException
*/
public WxMediaImgUploadResult mediaImgUpload(File file) throws WxErrorException;
WxMediaImgUploadResult mediaImgUpload(File file) throws WxErrorException;
/**
* <pre>
@ -72,7 +72,7 @@ public interface WxMpMaterialService {
* @param inputStream 输入流
* @throws WxErrorException
*/
public WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream inputStream) throws WxErrorException, IOException;
WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream inputStream) throws WxErrorException, IOException;
/**
* <pre>
@ -90,7 +90,7 @@ public interface WxMpMaterialService {
* @param mediaType 媒体类型, 请看{@link me.chanjar.weixin.common.api.WxConsts}
* @param material 上传的素材, 请看{@link me.chanjar.weixin.mp.bean.WxMpMaterial}
*/
public WxMpMaterialUploadResult materialFileUpload(String mediaType, WxMpMaterial material) throws WxErrorException;
WxMpMaterialUploadResult materialFileUpload(String mediaType, WxMpMaterial material) throws WxErrorException;
/**
* <pre>
@ -101,7 +101,7 @@ public interface WxMpMaterialService {
*
* @param news 上传的图文消息, 请看{@link me.chanjar.weixin.mp.bean.WxMpMaterialNews}
*/
public WxMpMaterialUploadResult materialNewsUpload(WxMpMaterialNews news) throws WxErrorException;
WxMpMaterialUploadResult materialNewsUpload(WxMpMaterialNews news) throws WxErrorException;
/**
* <pre>
@ -112,7 +112,7 @@ public interface WxMpMaterialService {
*
* @param media_id 永久素材的id
*/
public InputStream materialImageOrVoiceDownload(String media_id) throws WxErrorException;
InputStream materialImageOrVoiceDownload(String media_id) throws WxErrorException;
/**
* <pre>
@ -123,7 +123,7 @@ public interface WxMpMaterialService {
*
* @param media_id 永久素材的id
*/
public WxMpMaterialVideoInfoResult materialVideoInfo(String media_id) throws WxErrorException;
WxMpMaterialVideoInfoResult materialVideoInfo(String media_id) throws WxErrorException;
/**
* <pre>
@ -134,7 +134,7 @@ public interface WxMpMaterialService {
*
* @param media_id 永久素材的id
*/
public WxMpMaterialNews materialNewsInfo(String media_id) throws WxErrorException;
WxMpMaterialNews materialNewsInfo(String media_id) throws WxErrorException;
/**
* <pre>
@ -145,7 +145,7 @@ public interface WxMpMaterialService {
*
* @param wxMpMaterialArticleUpdate 用来更新图文素材的bean, 请看{@link me.chanjar.weixin.mp.bean.WxMpMaterialArticleUpdate}
*/
public boolean materialNewsUpdate(WxMpMaterialArticleUpdate wxMpMaterialArticleUpdate) throws WxErrorException;
boolean materialNewsUpdate(WxMpMaterialArticleUpdate wxMpMaterialArticleUpdate) throws WxErrorException;
/**
* <pre>
@ -156,7 +156,7 @@ public interface WxMpMaterialService {
*
* @param media_id 永久素材的id
*/
public boolean materialDelete(String media_id) throws WxErrorException;
boolean materialDelete(String media_id) throws WxErrorException;
/**
* <pre>
@ -165,7 +165,7 @@ public interface WxMpMaterialService {
* 详情请见: http://mp.weixin.qq.com/wiki/16/8cc64f8c189674b421bee3ed403993b8.html
* </pre>
*/
public WxMpMaterialCountResult materialCount() throws WxErrorException;
WxMpMaterialCountResult materialCount() throws WxErrorException;
/**
* <pre>
@ -177,7 +177,7 @@ public interface WxMpMaterialService {
* @param offset 从全部素材的该偏移位置开始返回0表示从第一个素材 返回
* @param count 返回素材的数量取值在1到20之间
*/
public WxMpMaterialNewsBatchGetResult materialNewsBatchGet(int offset, int count) throws WxErrorException;
WxMpMaterialNewsBatchGetResult materialNewsBatchGet(int offset, int count) throws WxErrorException;
/**
* <pre>
@ -190,6 +190,6 @@ public interface WxMpMaterialService {
* @param offset 从全部素材的该偏移位置开始返回0表示从第一个素材 返回
* @param count 返回素材的数量取值在1到20之间
*/
public WxMpMaterialFileBatchGetResult materialFileBatchGet(String type, int offset, int count) throws WxErrorException;
WxMpMaterialFileBatchGetResult materialFileBatchGet(String type, int offset, int count) throws WxErrorException;
}

View File

@ -18,7 +18,7 @@ public interface WxMpMenuService {
* 详情请见:http://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html
* </pre>
*/
public void menuCreate(WxMenu menu) throws WxErrorException;
void menuCreate(WxMenu menu) throws WxErrorException;
/**
* <pre>
@ -26,7 +26,7 @@ public interface WxMpMenuService {
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=自定义菜单删除接口
* </pre>
*/
public void menuDelete() throws WxErrorException;
void menuDelete() throws WxErrorException;
/**
* <pre>
@ -36,7 +36,7 @@ public interface WxMpMenuService {
*
* @param menuid
*/
public void menuDelete(String menuid) throws WxErrorException;
void menuDelete(String menuid) throws WxErrorException;
/**
* <pre>
@ -44,7 +44,7 @@ public interface WxMpMenuService {
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=自定义菜单查询接口
* </pre>
*/
public WxMenu menuGet() throws WxErrorException;
WxMenu menuGet() throws WxErrorException;
/**
* <pre>
@ -54,6 +54,6 @@ public interface WxMpMenuService {
*
* @param userid 可以是粉丝的OpenID也可以是粉丝的微信号
*/
public WxMenu menuTryMatch(String userid) throws WxErrorException;
WxMenu menuTryMatch(String userid) throws WxErrorException;
}

View File

@ -21,7 +21,7 @@ public interface WxMpMessageHandler {
* @param sessionManager
* @return xml格式的消息如果在异步规则里处理的话可以返回null
*/
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
Map<String, Object> context,
WxMpService wxMpService,
WxSessionManager sessionManager) throws WxErrorException;

View File

@ -22,7 +22,7 @@ public interface WxMpMessageInterceptor {
* @param sessionManager
* @return true代表OKfalse代表不OK
*/
public boolean intercept(WxMpXmlMessage wxMessage,
boolean intercept(WxMpXmlMessage wxMessage,
Map<String, Object> context,
WxMpService wxMpService,
WxSessionManager sessionManager) throws WxErrorException;

View File

@ -11,6 +11,6 @@ public interface WxMpMessageMatcher {
* 消息是否匹配某种模式
* @param message
*/
public boolean match(WxMpXmlMessage message);
boolean match(WxMpXmlMessage message);
}

View File

@ -209,10 +209,7 @@ public class WxMpMessageRouter {
messageId.append(wxMessage.getMsgId());
}
if (messageDuplicateChecker.isDuplicate(messageId.toString())) {
return true;
}
return false;
return messageDuplicateChecker.isDuplicate(messageId.toString());
}

View File

@ -21,7 +21,7 @@ public interface WxMpQrcodeService {
* @param scene_id 参数
* @param expire_seconds 过期秒数默认60秒最小60秒最大1800秒
*/
public WxMpQrCodeTicket qrCodeCreateTmpTicket(int scene_id, Integer expire_seconds) throws WxErrorException;
WxMpQrCodeTicket qrCodeCreateTmpTicket(int scene_id, Integer expire_seconds) throws WxErrorException;
/**
* <pre>
@ -31,7 +31,7 @@ public interface WxMpQrcodeService {
*
* @param scene_id 参数永久二维码时最大值为100000目前参数只支持1--100000
*/
public WxMpQrCodeTicket qrCodeCreateLastTicket(int scene_id) throws WxErrorException;
WxMpQrCodeTicket qrCodeCreateLastTicket(int scene_id) throws WxErrorException;
/**
* <pre>
@ -41,7 +41,7 @@ public interface WxMpQrcodeService {
*
* @param scene_str 参数字符串类型长度现在为1到64
*/
public WxMpQrCodeTicket qrCodeCreateLastTicket(String scene_str) throws WxErrorException;
WxMpQrCodeTicket qrCodeCreateLastTicket(String scene_str) throws WxErrorException;
/**
* <pre>
@ -51,7 +51,7 @@ public interface WxMpQrcodeService {
*
* @param ticket 二维码ticket
*/
public File qrCodePicture(WxMpQrCodeTicket ticket) throws WxErrorException;
File qrCodePicture(WxMpQrCodeTicket ticket) throws WxErrorException;
/**
* <pre>
@ -62,7 +62,7 @@ public interface WxMpQrcodeService {
* @param ticket 二维码ticket
* @param needShortUrl 是否需要压缩的二维码地址
*/
public String qrCodePictureUrl(String ticket, boolean needShortUrl) throws WxErrorException;
String qrCodePictureUrl(String ticket, boolean needShortUrl) throws WxErrorException;
/**
* <pre>
@ -72,6 +72,6 @@ public interface WxMpQrcodeService {
*
* @param ticket 二维码ticket
*/
public String qrCodePictureUrl(String ticket) throws WxErrorException;
String qrCodePictureUrl(String ticket) throws WxErrorException;
}

View File

@ -25,7 +25,7 @@ public interface WxMpUserService {
* @param openid 用户openid
* @param remark 备注名
*/
public void userUpdateRemark(String openid, String remark) throws WxErrorException;
void userUpdateRemark(String openid, String remark) throws WxErrorException;
/**
* <pre>
@ -36,7 +36,7 @@ public interface WxMpUserService {
* @param openid 用户openid
* @param lang 语言zh_CN 简体(默认)zh_TW 繁体en 英语
*/
public WxMpUser userInfo(String openid, String lang) throws WxErrorException;
WxMpUser userInfo(String openid, String lang) throws WxErrorException;
/**
* <pre>
@ -46,7 +46,7 @@ public interface WxMpUserService {
*
* @param next_openid 可选第一个拉取的OPENIDnull为从头开始拉取
*/
public WxMpUserList userList(String next_openid) throws WxErrorException;
WxMpUserList userList(String next_openid) throws WxErrorException;
/**
* <pre>

View File

@ -24,7 +24,7 @@ public class MaterialDeleteRequestExecutor implements RequestExecutor<Boolean, S
super();
}
public Boolean execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String materialId) throws WxErrorException, ClientProtocolException, IOException {
public Boolean execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String materialId) throws WxErrorException, IOException {
HttpPost httpPost = new HttpPost(uri);
if (httpProxy != null) {
RequestConfig config = RequestConfig.custom().setProxy(httpProxy).build();

View File

@ -25,7 +25,7 @@ public class MaterialNewsInfoRequestExecutor implements RequestExecutor<WxMpMate
super();
}
public WxMpMaterialNews execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String materialId) throws WxErrorException, ClientProtocolException, IOException {
public WxMpMaterialNews execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String materialId) throws WxErrorException, IOException {
HttpPost httpPost = new HttpPost(uri);
if (httpProxy != null) {
RequestConfig config = RequestConfig.custom().setProxy(httpProxy).build();

View File

@ -23,7 +23,7 @@ import java.util.Map;
public class MaterialUploadRequestExecutor implements RequestExecutor<WxMpMaterialUploadResult, WxMpMaterial> {
@Override
public WxMpMaterialUploadResult execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, WxMpMaterial material) throws WxErrorException, ClientProtocolException, IOException {
public WxMpMaterialUploadResult execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, WxMpMaterial material) throws WxErrorException, IOException {
HttpPost httpPost = new HttpPost(uri);
if (httpProxy != null) {
RequestConfig response = RequestConfig.custom().setProxy(httpProxy).build();

View File

@ -24,7 +24,7 @@ public class MaterialVideoInfoRequestExecutor implements RequestExecutor<WxMpMat
super();
}
public WxMpMaterialVideoInfoResult execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String materialId) throws WxErrorException, ClientProtocolException, IOException {
public WxMpMaterialVideoInfoResult execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String materialId) throws WxErrorException, IOException {
HttpPost httpPost = new HttpPost(uri);
if (httpProxy != null) {
RequestConfig config = RequestConfig.custom().setProxy(httpProxy).build();

View File

@ -34,7 +34,7 @@ public class MaterialVoiceAndImageDownloadRequestExecutor implements RequestExec
this.tmpDirFile = tmpDirFile;
}
public InputStream execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String materialId) throws WxErrorException, ClientProtocolException, IOException {
public InputStream execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String materialId) throws WxErrorException, IOException {
HttpPost httpPost = new HttpPost(uri);
if (httpProxy != null) {
RequestConfig config = RequestConfig.custom().setProxy(httpProxy).build();

View File

@ -24,7 +24,7 @@ import java.io.IOException;
*/
public class MediaImgUploadRequestExecutor implements RequestExecutor<WxMediaImgUploadResult, File> {
@Override
public WxMediaImgUploadResult execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, File data) throws WxErrorException, ClientProtocolException, IOException {
public WxMediaImgUploadResult execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, File data) throws WxErrorException, IOException {
HttpPost httpPost = new HttpPost(uri);
if (httpProxy != null) {
RequestConfig config = RequestConfig.custom().setProxy(httpProxy).build();

View File

@ -31,7 +31,7 @@ public class QrCodeRequestExecutor implements RequestExecutor<File, WxMpQrCodeTi
@Override
public File execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri,
WxMpQrCodeTicket ticket) throws WxErrorException, ClientProtocolException, IOException {
WxMpQrCodeTicket ticket) throws WxErrorException, IOException {
if (ticket != null) {
if (uri.indexOf('?') == -1) {
uri += '?';

View File

@ -18,7 +18,7 @@ public class WxLongTimeJsonSerializer extends JsonSerializer<Long> {
@Override
public void serialize(Long value, JsonGenerator gen,
SerializerProvider serializers)
throws IOException, JsonProcessingException {
throws IOException {
gen.writeString(DF.format(value * 1000));
}
}

View File

@ -21,7 +21,7 @@ public class WxMpUserGsonAdapter implements JsonDeserializer<WxMpUser> {
WxMpUser wxMpUser = new WxMpUser();
Integer subscribe = GsonHelper.getInteger(o, "subscribe");
if (subscribe != null) {
wxMpUser.setSubscribe(new Integer(0).equals(subscribe) ? false : true);
wxMpUser.setSubscribe(!new Integer(0).equals(subscribe));
}
wxMpUser.setCity(GsonHelper.getString(o, "city"));
wxMpUser.setCountry(GsonHelper.getString(o, "country"));

View File

@ -49,7 +49,6 @@ public class WxMpMessageRouterTest {
}
}).handler(new WxEchoMpMessageHandler(sb, "matcher")).end()
.rule().async(async).handler(new WxEchoMpMessageHandler(sb, "ALL")).end();
;
}
@Test(dataProvider="messages-1")