Let's walk through it.
First, obj is final and:
if (obj == null) {
return false;
}
After that obj is _never_ null. Then. later:
final ThreadContextStack other = (ThreadContextStack) obj;
So other is _never_ null, then finally:
return other == null;
which is never true, hence return false;
Check?
Gary
On Sun, Aug 9, 2015 at 7:59 PM, Remko Popma <[email protected]> wrote:
> Hang on, this changes the semantics!
> If value is null and other is null we want to return true, not false.
>
> Sent from my iPhone
>
> > On 2015/08/10, at 11:16, [email protected] wrote:
> >
> > Repository: logging-log4j2
> > Updated Branches:
> > refs/heads/master 3eeb2f6c9 -> cbab41909
> >
> >
> > Null comparison always yields false, so return false.
> >
> >
> > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> > Commit:
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/cbab4190
> > Tree:
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/cbab4190
> > Diff:
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/cbab4190
> >
> > Branch: refs/heads/master
> > Commit: cbab4190931af2f28935fd7b3503e2c78efaed79
> > Parents: 3eeb2f6
> > Author: ggregory <[email protected]>
> > Authored: Sun Aug 9 19:15:59 2015 -0700
> > Committer: ggregory <[email protected]>
> > Committed: Sun Aug 9 19:15:59 2015 -0700
> >
> > ----------------------------------------------------------------------
> > .../org/apache/logging/log4j/spi/DefaultThreadContextStack.java | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > ----------------------------------------------------------------------
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/cbab4190/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextStack.java
> > ----------------------------------------------------------------------
> > diff --git
> a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextStack.java
> b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextStack.java
> > index 12229ca..5e2921b 100644
> > ---
> a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextStack.java
> > +++
> b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextStack.java
> > @@ -128,7 +128,7 @@ public class DefaultThreadContextStack implements
> ThreadContextStack {
> > final ThreadContextStack other = (ThreadContextStack) obj;
> > final MutableThreadContextStack values = stack.get();
> > if (values == null) {
> > - return other == null;
> > + return false;
> > }
> > return values.equals(other);
> > }
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
E-Mail: [email protected] | [email protected]
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory