From 26a4e0b26ed4eaceb4b6ff4dcb1e4564a7980f57 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Thu, 17 May 2007 13:45:03 +0000
Subject: [PATCH] added guard to prevent runtime error in case ApplicationException.Type is null

---
 opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java |   33 ++++++++++++++++++++-------------
 1 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java b/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
index 3327919..49b27c7 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
@@ -34,6 +34,8 @@
 import org.opends.quicksetup.event.ProgressUpdateEvent;
 import org.opends.quicksetup.i18n.ResourceProvider;
 
+import java.lang.reflect.Type;
+
 /**
  * Controller for managing the execution of a CliApplication.
  */
@@ -143,23 +145,28 @@
         ApplicationException ue = cliApp.getException();
         if (ue != null)
         {
-          switch (ue.getType())
-          {
-          case FILE_SYSTEM_ERROR:
-            returnValue = ERROR_ACCESSING_FILE_SYSTEM;
-            break;
+          ApplicationException.Type type = ue.getType();
+          if (type != null) {
+            switch (type)
+            {
+            case FILE_SYSTEM_ERROR:
+              returnValue = ERROR_ACCESSING_FILE_SYSTEM;
+              break;
 
-          case STOP_ERROR:
-            returnValue = ERROR_STOPPING_SERVER;
-            break;
+            case STOP_ERROR:
+              returnValue = ERROR_STOPPING_SERVER;
+              break;
 
-          case BUG:
-            returnValue = BUG;
-            break;
+            case BUG:
+              returnValue = BUG;
+              break;
 
-          default:
+            default:
+              returnValue = UNKNOWN;
+              break;
+            }
+          } else {
             returnValue = UNKNOWN;
-            break;
           }
         }
         else

--
Gitblit v1.10.0