You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bs...@apache.org on 2015/11/20 22:02:02 UTC

[08/50] [abbrv] incubator-geode git commit: GEODE-77: fixing a ClassCastException observed in integration testing.

GEODE-77: fixing a ClassCastException observed in integration testing.

Sometimes the 'object' returned by the GC function is a String description
of an exception encountered while executing the function in another
member.  In that case we want to return the exception description to
gfsh as the result.


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

Branch: refs/heads/develop
Commit: 9d110301f31d6176b276b69603fc998cd7db588c
Parents: 0c1008e
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Wed Oct 21 14:06:00 2015 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Wed Oct 21 14:06:00 2015 -0700

----------------------------------------------------------------------
 .../cli/commands/MiscellaneousCommands.java     | 22 +++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9d110301/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommands.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommands.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommands.java
index 852a507..4ebd947 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommands.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/MiscellaneousCommands.java
@@ -380,18 +380,24 @@ public class MiscellaneousCommands implements CommandMarker {
         }
 
         if(object != null){
-          Map<String, String> resultMap = (Map<String, String>) object;
-          toTabularResultData(resultTable, (String) resultMap.get("MemberId"),
-              (String) resultMap.get("HeapSizeBeforeGC"),
-              (String) resultMap.get("HeapSizeAfterGC"),
-              (String) resultMap.get("TimeSpentInGC"));
-        }else{
+          if (object instanceof String) {
+            // unexpected exception string - cache may be closed or something
+            return ResultBuilder.createUserErrorResult((String)object);
+          } else {
+            Map<String, String> resultMap = (Map<String, String>) object;
+            toTabularResultData(resultTable, (String) resultMap.get("MemberId"),
+                (String) resultMap.get("HeapSizeBeforeGC"),
+                (String) resultMap.get("HeapSizeAfterGC"),
+                (String) resultMap.get("TimeSpentInGC"));
+          }
+        } else {
           LogWrapper.getInstance().fine("ResultMap was null ");
         }
       }
     } catch (Exception e) {
-      LogWrapper.getInstance().info("GC exception is " + CliUtil.stackTraceAsString((Throwable)e));
-      return ResultBuilder.createGemFireErrorResult(e.getMessage());
+      String stack = CliUtil.stackTraceAsString(e);
+      LogWrapper.getInstance().info("GC exception is " + stack);
+      return ResultBuilder.createGemFireErrorResult(e.getMessage() + ": " + stack);
     }
     return ResultBuilder.buildResult(resultTable);
   }