geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject [35/50] incubator-geode git commit: GEODE-152: fix NPE in fetchJvmThreads
Date Fri, 24 Jul 2015 23:15:58 GMT
GEODE-152: fix NPE in fetchJvmThreads

The code now uses an ArrayList and only adds non-null elements to it.
It then allocates a array of that ArrayList size and returns it with
the contents of the ArrayList.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/dd4ab5f4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/dd4ab5f4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/dd4ab5f4

Branch: refs/heads/feature/GEODE-86
Commit: dd4ab5f4cfb85741f4a466e96dd814c2fe953a5a
Parents: aeafb01
Author: Darrel Schneider <dschneider@pivotal.io>
Authored: Thu Jul 23 14:42:53 2015 -0700
Committer: Darrel Schneider <dschneider@pivotal.io>
Committed: Thu Jul 23 14:42:53 2015 -0700

----------------------------------------------------------------------
 .../management/internal/beans/MemberMBeanBridge.java     | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dd4ab5f4/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/beans/MemberMBeanBridge.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/beans/MemberMBeanBridge.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/beans/MemberMBeanBridge.java
index 6a2d085..b546868 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/beans/MemberMBeanBridge.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/beans/MemberMBeanBridge.java
@@ -1325,13 +1325,14 @@ public class MemberMBeanBridge {
     if (threadInfos == null || threadInfos.length < 1) {
       return ManagementConstants.NO_DATA_STRING;
     }
-    String[] thrdStr = new String[threadInfos.length];
-    int j = 0;
+    ArrayList<String> thrdStr = new ArrayList<String>(threadInfos.length);
     for (ThreadInfo thInfo : threadInfos) {
-      thrdStr[j] = thInfo.getThreadName();
-      j++;
+      if (thInfo != null) {
+        thrdStr.add(thInfo.getThreadName());
+      }
     }
-    return thrdStr;
+    String[] result = new String[thrdStr.size()];
+    return thrdStr.toArray(result);
   }
 
   /**


Mime
View raw message