commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject [2/3] [lang] Fix potential NPE by checking for object identity instead of comparing one property only
Date Thu, 07 May 2015 16:07:25 GMT
Fix potential NPE by checking for object identity instead of comparing one property only


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/6bb87178
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/6bb87178
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/6bb87178

Branch: refs/heads/master
Commit: 6bb871786e563ed82e2b8d26314c22772808fe5d
Parents: 8ac3334
Author: Benedikt Ritter <britter@apache.org>
Authored: Thu May 7 18:06:48 2015 +0200
Committer: Benedikt Ritter <britter@apache.org>
Committed: Thu May 7 18:06:48 2015 +0200

----------------------------------------------------------------------
 src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6bb87178/src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java b/src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java
index 8f0ec01..b0ad310 100644
--- a/src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ThreadUtilsTest.java
@@ -174,7 +174,7 @@ public class ThreadUtilsTest {
         try {
             t1.start();
             t2.start();
-            assertEquals(t1.getName(), ThreadUtils.findThreadById(t1.getId()).getName());
+            assertSame(t1, ThreadUtils.findThreadById(t1.getId()));
             assertSame(t2, ThreadUtils.findThreadById(t2.getId()));
         } finally {
             t1.interrupt();
@@ -261,8 +261,8 @@ public class ThreadUtilsTest {
         try {
             t1.start();
             t2.start();
-            assertEquals(t1.getName(), ThreadUtils.findThreadById(t1.getId(),"thread_group_DDZZ99__").getName());
-            assertEquals(t2.getName(), ThreadUtils.findThreadById(t2.getId(),"thread_group_DDZZ99__").getName());
+            assertSame(t1, ThreadUtils.findThreadById(t1.getId(),"thread_group_DDZZ99__"));
+            assertSame(t2, ThreadUtils.findThreadById(t2.getId(),"thread_group_DDZZ99__"));
             assertNull(ThreadUtils.findThreadById(nonExistingId,"non_existent_thread_group_JJHHZZ__"));
             assertNull(ThreadUtils.findThreadById(nonExistingId,"thread_group_DDZZ99__"));
         } finally {


Mime
View raw message