mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-06-28 13:16:19 +08:00
".equals()" should not be used to test the values of "Atomic" classes
This commit is contained in:
parent
242ccc2a01
commit
84a79a9760
@ -12,7 +12,7 @@ public class StandardSession implements WxSession, InternalSession {
|
|||||||
* The string manager for this package.
|
* The string manager for this package.
|
||||||
*/
|
*/
|
||||||
protected static final StringManager sm =
|
protected static final StringManager sm =
|
||||||
StringManager.getManager(Constants.Package);
|
StringManager.getManager(Constants.Package);
|
||||||
/**
|
/**
|
||||||
* Type array.
|
* Type array.
|
||||||
*/
|
*/
|
||||||
@ -73,7 +73,7 @@ public class StandardSession implements WxSession, InternalSession {
|
|||||||
|
|
||||||
if (!isValidInternal())
|
if (!isValidInternal())
|
||||||
throw new IllegalStateException
|
throw new IllegalStateException
|
||||||
(sm.getString("sessionImpl.getAttribute.ise"));
|
(sm.getString("sessionImpl.getAttribute.ise"));
|
||||||
|
|
||||||
if (name == null) return null;
|
if (name == null) return null;
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ public class StandardSession implements WxSession, InternalSession {
|
|||||||
public Enumeration<String> getAttributeNames() {
|
public Enumeration<String> getAttributeNames() {
|
||||||
if (!isValidInternal())
|
if (!isValidInternal())
|
||||||
throw new IllegalStateException
|
throw new IllegalStateException
|
||||||
(sm.getString("sessionImpl.getAttributeNames.ise"));
|
(sm.getString("sessionImpl.getAttributeNames.ise"));
|
||||||
|
|
||||||
Set<String> names = new HashSet<>();
|
Set<String> names = new HashSet<>();
|
||||||
names.addAll(this.attributes.keySet());
|
names.addAll(this.attributes.keySet());
|
||||||
@ -96,7 +96,7 @@ public class StandardSession implements WxSession, InternalSession {
|
|||||||
// Name cannot be null
|
// Name cannot be null
|
||||||
if (name == null)
|
if (name == null)
|
||||||
throw new IllegalArgumentException
|
throw new IllegalArgumentException
|
||||||
(sm.getString("sessionImpl.setAttribute.namenull"));
|
(sm.getString("sessionImpl.setAttribute.namenull"));
|
||||||
|
|
||||||
// Null value is the same as removeAttribute()
|
// Null value is the same as removeAttribute()
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@ -107,7 +107,7 @@ public class StandardSession implements WxSession, InternalSession {
|
|||||||
// Validate our current state
|
// Validate our current state
|
||||||
if (!isValidInternal())
|
if (!isValidInternal())
|
||||||
throw new IllegalStateException(sm.getString(
|
throw new IllegalStateException(sm.getString(
|
||||||
"sessionImpl.setAttribute.ise", getIdInternal()));
|
"sessionImpl.setAttribute.ise", getIdInternal()));
|
||||||
|
|
||||||
this.attributes.put(name, value);
|
this.attributes.put(name, value);
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ public class StandardSession implements WxSession, InternalSession {
|
|||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
if (!isValidInternal())
|
if (!isValidInternal())
|
||||||
throw new IllegalStateException
|
throw new IllegalStateException
|
||||||
(sm.getString("sessionImpl.invalidate.ise"));
|
(sm.getString("sessionImpl.invalidate.ise"));
|
||||||
|
|
||||||
// Cause this session to expire
|
// Cause this session to expire
|
||||||
expire();
|
expire();
|
||||||
@ -305,7 +305,7 @@ public class StandardSession implements WxSession, InternalSession {
|
|||||||
if (this.isValid != session.isValid) return false;
|
if (this.isValid != session.isValid) return false;
|
||||||
if (this.maxInactiveInterval != session.maxInactiveInterval) return false;
|
if (this.maxInactiveInterval != session.maxInactiveInterval) return false;
|
||||||
if (this.thisAccessedTime != session.thisAccessedTime) return false;
|
if (this.thisAccessedTime != session.thisAccessedTime) return false;
|
||||||
if (!this.accessCount.equals(session.accessCount)) return false;
|
if (this.accessCount.get() != session.accessCount.get()) return false;
|
||||||
if (!this.attributes.equals(session.attributes)) return false;
|
if (!this.attributes.equals(session.attributes)) return false;
|
||||||
if (!this.facade.equals(session.facade)) return false;
|
if (!this.facade.equals(session.facade)) return false;
|
||||||
if (!this.id.equals(session.id)) return false;
|
if (!this.id.equals(session.id)) return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user