Sfoglia il codice sorgente

".equals()" should not be used to test the values of "Atomic" classes

master
Binary Wang 8 anni fa
parent
commit
84a79a9760
1 ha cambiato i file con 7 aggiunte e 7 eliminazioni
  1. +7
    -7
      weixin-java-common/src/main/java/me/chanjar/weixin/common/session/StandardSession.java

+ 7
- 7
weixin-java-common/src/main/java/me/chanjar/weixin/common/session/StandardSession.java Vedi File

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


Caricamento…
Annulla
Salva