From 794a46abb22dd1cf58a48bf096a15117fa799859 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Tue, 05 Jun 2007 14:06:42 +0000
Subject: [PATCH] protect against NPE in cases where something is fundamentally wrong and things are not initialized as usual

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/HistoricalRecord.java |   35 ++++++++++++++++++++---------------
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties |    5 +++--
 2 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
index 51929d3..280e88d 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
@@ -853,7 +853,7 @@
   <br>The upgrade operation was canceled and the installation has been \
   restored to the state it was in before the upgrade operation.\
   <br><br><INPUT type="submit" value="Launch Status Panel"></INPUT>
-summary-upgrade-finished-canceled-cli=<b>OpenDS QuickUpgrade Canceled. \
+summary-upgrade-finished-canceled-cli=OpenDS QuickUpgrade Canceled. \
   The upgrade operation was canceled and the installation has been \
   restored to the state it was in before the upgrade operation.
 #
@@ -1042,4 +1042,5 @@
 
 general-loading=Loading...
 general-see-for-details=See {0} for a detailed log of this operation.
-general-build-id=Build ID
\ No newline at end of file
+general-build-id=Build ID
+general-unset=Unset
\ No newline at end of file
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/HistoricalRecord.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/HistoricalRecord.java
index a1c4785..f36aeab 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/HistoricalRecord.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/HistoricalRecord.java
@@ -28,6 +28,7 @@
 package org.opends.quicksetup.upgrader;
 
 import org.opends.quicksetup.BuildInformation;
+import org.opends.quicksetup.i18n.ResourceProvider;
 
 import java.util.StringTokenizer;
 import java.util.EnumSet;
@@ -270,21 +271,21 @@
    * {@inheritDoc}
    */
   public String toString() {
-    StringBuilder sb = new StringBuilder()
-    .append(OPERATION)
-    .append(operationId)
-    .append(SEPARATOR)
-    .append(TIME)
-    .append(new SimpleDateFormat(DATE_FORMAT).format(date))
-    .append(SEPARATOR)
-    .append(FROM)
-    .append(from.getBuildString())
-    .append(SEPARATOR)
-    .append(TO)
-    .append(to.getBuildString())
-    .append(SEPARATOR)
-    .append(STATUS)
-    .append(status);
+    StringBuilder sb = new StringBuilder();
+    sb.append(OPERATION);
+    sb.append(operationId != null ? operationId : getMsg("general-unset"));
+    sb.append(SEPARATOR);
+    sb.append(TIME);
+    sb.append(new SimpleDateFormat(DATE_FORMAT).format(date));
+    sb.append(SEPARATOR);
+    sb.append(FROM);
+    sb.append(from != null ? from.getBuildString() : getMsg("general-unset"));
+    sb.append(SEPARATOR);
+    sb.append(TO);
+    sb.append(to != null ? to.getBuildString() : getMsg("general-unset"));
+    sb.append(SEPARATOR);
+    sb.append(STATUS);
+    sb.append(status);
     if (note != null) {
       sb.append(SEPARATOR)
       .append(NOTE)
@@ -293,4 +294,8 @@
     return sb.toString();
   }
 
+  private String getMsg(String key) {
+    return ResourceProvider.getInstance().getMsg(key);
+  }
+
 }

--
Gitblit v1.10.0