Skip to content

Commit b1f0b07

Browse files
committed
代码优化,由IDEA自动进行的Code Cleanup
1 parent 38ab775 commit b1f0b07

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+140
-156
lines changed

weixin-java-common/src/main/java/me/chanjar/weixin/common/api/WxErrorExceptionHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
*/
88
public interface WxErrorExceptionHandler {
99

10-
public void handle(WxErrorException e);
10+
void handle(WxErrorException e);
1111

1212
}

weixin-java-common/src/main/java/me/chanjar/weixin/common/api/WxMessageDuplicateChecker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ public interface WxMessageDuplicateChecker {
2222
* @param messageId messageId需要根据上面讲的方式构造
2323
* @return 如果是重复消息,返回true,否则返回false
2424
*/
25-
public boolean isDuplicate(String messageId);
25+
boolean isDuplicate(String messageId);
2626

2727
}

weixin-java-common/src/main/java/me/chanjar/weixin/common/api/WxMessageInMemoryDuplicateChecker.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,7 @@ public boolean isDuplicate(String messageId) {
8787
}
8888
checkBackgroundProcessStarted();
8989
Long timestamp = msgId2Timestamp.putIfAbsent(messageId, System.currentTimeMillis());
90-
if (timestamp == null) {
91-
// 第一次接收到这个消息
92-
return false;
93-
}
94-
return true;
90+
return timestamp != null;
9591
}
9692

9793

weixin-java-common/src/main/java/me/chanjar/weixin/common/session/InternalSession.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public interface InternalSession {
1313
*
1414
* @param isValid The new value for the <code>isValid</code> flag
1515
*/
16-
public void setValid(boolean isValid);
16+
void setValid(boolean isValid);
1717

1818
/**
1919
* Return the <code>isValid</code> flag for this session.

weixin-java-common/src/main/java/me/chanjar/weixin/common/session/InternalSessionManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@ public interface InternalSessionManager {
2828
* @exception IllegalStateException if a new session cannot be
2929
* instantiated for any reason
3030
*/
31-
public InternalSession createSession(String sessionId);
31+
InternalSession createSession(String sessionId);
3232

3333
/**
3434
* Remove this Session from the active Sessions for this Manager.
3535
*
3636
* @param session Session to be removed
3737
*/
38-
public void remove(InternalSession session);
38+
void remove(InternalSession session);
3939

4040
/**
4141
* Remove this Session from the active Sessions for this Manager.
4242
*
4343
* @param session Session to be removed
4444
* @param update Should the expiration statistics be updated
4545
*/
46-
public void remove(InternalSession session, boolean update);
46+
void remove(InternalSession session, boolean update);
4747

4848
/**
4949
* Add this Session to the set of active Sessions for this Manager.
@@ -71,7 +71,7 @@ public interface InternalSessionManager {
7171
/**
7272
* Implements the Manager interface, direct call to processExpires
7373
*/
74-
public void backgroundProcess();
74+
void backgroundProcess();
7575

7676
/**
7777
* Set the default maximum inactive interval (in seconds)

weixin-java-common/src/main/java/me/chanjar/weixin/common/session/StandardSession.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,8 @@ public boolean equals(Object o) {
323323
if (!attributes.equals(session.attributes)) return false;
324324
if (!facade.equals(session.facade)) return false;
325325
if (!id.equals(session.id)) return false;
326-
if (!manager.equals(session.manager)) return false;
326+
return manager.equals(session.manager);
327327

328-
return true;
329328
}
330329

331330
@Override

weixin-java-common/src/main/java/me/chanjar/weixin/common/session/WxSession.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
public interface WxSession {
66

7-
public Object getAttribute(String name);
7+
Object getAttribute(String name);
88

9-
public Enumeration<String> getAttributeNames();
9+
Enumeration<String> getAttributeNames();
1010

11-
public void setAttribute(String name, Object value);
11+
void setAttribute(String name, Object value);
1212

13-
public void removeAttribute(String name);
13+
void removeAttribute(String name);
1414

15-
public void invalidate();
15+
void invalidate();
1616

1717
}

weixin-java-common/src/main/java/me/chanjar/weixin/common/session/WxSessionManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ public interface WxSessionManager {
55
/**
66
* 获取某个sessionId对应的session,如果sessionId没有对应的session,则新建一个并返回。
77
*/
8-
public WxSession getSession(String sessionId);
8+
WxSession getSession(String sessionId);
99

1010
/**
1111
* 获取某个sessionId对应的session,如果sessionId没有对应的session,若create为true则新建一个,否则返回null。
1212
*/
13-
public WxSession getSession(String sessionId, boolean create);
13+
WxSession getSession(String sessionId, boolean create);
1414

1515

1616
}

weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/InputStreamResponseHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class InputStreamResponseHandler implements ResponseHandler<InputStream>
1414

1515
public static final ResponseHandler<InputStream> INSTANCE = new InputStreamResponseHandler();
1616

17-
public InputStream handleResponse(final HttpResponse response) throws HttpResponseException, IOException {
17+
public InputStream handleResponse(final HttpResponse response) throws IOException {
1818
final StatusLine statusLine = response.getStatusLine();
1919
final HttpEntity entity = response.getEntity();
2020
if (statusLine.getStatusCode() >= 300) {

weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/MediaDownloadRequestExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public MediaDownloadRequestExecutor(File tmpDirFile) {
3939

4040

4141
@Override
42-
public File execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String queryParam) throws WxErrorException, ClientProtocolException, IOException {
42+
public File execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String queryParam) throws WxErrorException, IOException {
4343
if (queryParam != null) {
4444
if (uri.indexOf('?') == -1) {
4545
uri += '?';

0 commit comments

Comments
 (0)