Skip to content

Commit 84a79a9

Browse files
committed
".equals()" should not be used to test the values of "Atomic" classes
1 parent 242ccc2 commit 84a79a9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class StandardSession implements WxSession, InternalSession {
1212
* The string manager for this package.
1313
*/
1414
protected static final StringManager sm =
15-
StringManager.getManager(Constants.Package);
15+
StringManager.getManager(Constants.Package);
1616
/**
1717
* Type array.
1818
*/
@@ -73,7 +73,7 @@ public Object getAttribute(String name) {
7373

7474
if (!isValidInternal())
7575
throw new IllegalStateException
76-
(sm.getString("sessionImpl.getAttribute.ise"));
76+
(sm.getString("sessionImpl.getAttribute.ise"));
7777

7878
if (name == null) return null;
7979

@@ -84,7 +84,7 @@ public Object getAttribute(String name) {
8484
public Enumeration<String> getAttributeNames() {
8585
if (!isValidInternal())
8686
throw new IllegalStateException
87-
(sm.getString("sessionImpl.getAttributeNames.ise"));
87+
(sm.getString("sessionImpl.getAttributeNames.ise"));
8888

8989
Set<String> names = new HashSet<>();
9090
names.addAll(this.attributes.keySet());
@@ -96,7 +96,7 @@ public void setAttribute(String name, Object value) {
9696
// Name cannot be null
9797
if (name == null)
9898
throw new IllegalArgumentException
99-
(sm.getString("sessionImpl.setAttribute.namenull"));
99+
(sm.getString("sessionImpl.setAttribute.namenull"));
100100

101101
// Null value is the same as removeAttribute()
102102
if (value == null) {
@@ -107,7 +107,7 @@ public void setAttribute(String name, Object value) {
107107
// Validate our current state
108108
if (!isValidInternal())
109109
throw new IllegalStateException(sm.getString(
110-
"sessionImpl.setAttribute.ise", getIdInternal()));
110+
"sessionImpl.setAttribute.ise", getIdInternal()));
111111

112112
this.attributes.put(name, value);
113113

@@ -122,7 +122,7 @@ public void removeAttribute(String name) {
122122
public void invalidate() {
123123
if (!isValidInternal())
124124
throw new IllegalStateException
125-
(sm.getString("sessionImpl.invalidate.ise"));
125+
(sm.getString("sessionImpl.invalidate.ise"));
126126

127127
// Cause this session to expire
128128
expire();
@@ -305,7 +305,7 @@ public boolean equals(Object o) {
305305
if (this.isValid != session.isValid) return false;
306306
if (this.maxInactiveInterval != session.maxInactiveInterval) return false;
307307
if (this.thisAccessedTime != session.thisAccessedTime) return false;
308-
if (!this.accessCount.equals(session.accessCount)) return false;
308+
if (this.accessCount.get() != session.accessCount.get()) return false;
309309
if (!this.attributes.equals(session.attributes)) return false;
310310
if (!this.facade.equals(session.facade)) return false;
311311
if (!this.id.equals(session.id)) return false;

0 commit comments

Comments
 (0)