Fixed FELIX-3986 ThreadDumper comparators are not correctly implemented
https://issues.apache.org/jira/browse/FELIX-3986

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1459347 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadDumper.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadDumper.java
index ca3cf04..c226df5 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadDumper.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadDumper.java
@@ -348,8 +348,19 @@
 

     public int compare(Object thread1, Object thread2)

     {

-        if (null == thread1 || null == thread2)

-            return -1;

+        if (thread1 == null && thread2 == null)

+        {

+            return 0;

+        }

+        if (thread1 == null)

+        {

+            return 1; // null is always >, moves nulls at the end

+        }

+        if (thread2 == null)

+        {

+            return -1; // first is always < than null, moves nulls at the end 

+        }

+

         String t1 = ((Thread) thread1).getName();

         String t2 = ((Thread) thread2).getName();

         if (null == t1)

@@ -383,8 +394,19 @@
 

     public int compare(Object thread1, Object thread2)

     {

-        if (null == thread1 || null == thread2)

-            return -1;

+        if (thread1 == null && thread2 == null)

+        {

+            return 0;

+        }

+        if (thread1 == null)

+        {

+            return 1; // null is always >, moves nulls at the end

+        }

+        if (thread2 == null)

+        {

+            return -1; // first is always < than null, moves nulls at the end 

+        }

+

         String t1 = ((ThreadGroup) thread1).getName();

         String t2 = ((ThreadGroup) thread2).getName();

         if (null == t1)