logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1593077 - /logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/MutableThreadContextStack.java
Date Wed, 07 May 2014 17:41:19 GMT
Author: ggregory
Date: Wed May  7 17:41:19 2014
New Revision: 1593077

URL: http://svn.apache.org/r1593077
Log:
Implement equals() and hashCode(); for XML and JSON receiver testing.

Modified:
    logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/MutableThreadContextStack.java

Modified: logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/MutableThreadContextStack.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/MutableThreadContextStack.java?rev=1593077&r1=1593076&r2=1593077&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/MutableThreadContextStack.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/MutableThreadContextStack.java
Wed May  7 17:41:19 2014
@@ -166,4 +166,35 @@ public class MutableThreadContextStack i
     public String toString() {
         return String.valueOf(list);
     }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((this.list == null) ? 0 : this.list.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof ThreadContextStack)) {
+            return false;
+        }
+        ThreadContextStack other = (ThreadContextStack) obj;
+        final List<String> otherAsList = other.asList();
+        if (this.list == null) {
+            if (otherAsList != null) {
+                return false;
+            }
+        } else if (!this.list.equals(otherAsList)) {
+            return false;
+        }
+        return true;
+    }
 }



Mime
View raw message