From bd0c5f6b5a23cecc8936601aaed21cae653d276f Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Thu, 23 Jun 2011 12:43:27 +0000
Subject: [PATCH] Fix issue OPENDJ-207. setup in CLI mode seems to require GUI (or X server). Some formatting code was making calls to Font (javax.awt.font) which triggered calls to the Graphic subsystem.

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java                  |   10 ++++++++--
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java   |    3 ++-
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java |    3 ++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index f5c74c8..1208c25 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -2164,9 +2164,11 @@
    * Updates the contents of the provided map with the localized summary
    * strings.
    * @param hmSummary the Map to be updated.
+   * @param isCli a boolean to indicate if the install is using CLI or GUI
    */
   protected void initSummaryMap(
-      Map<InstallProgressStep, Message> hmSummary)
+      Map<InstallProgressStep, Message> hmSummary,
+      boolean isCli)
   {
     hmSummary.put(InstallProgressStep.NOT_STARTED,
         getFormattedSummary(INFO_SUMMARY_INSTALL_NOT_STARTED.get()));
@@ -2204,7 +2206,11 @@
     Installation installation = getInstallation();
     String cmd = Utils.addWordBreaks(
         getPath(installation.getControlPanelCommandFile()), 60, 5);
-    cmd = UIFactory.applyFontToHtml(cmd, UIFactory.INSTRUCTIONS_MONOSPACE_FONT);
+    if (!isCli)
+    {
+      cmd = UIFactory.applyFontToHtml(cmd,
+                    UIFactory.INSTRUCTIONS_MONOSPACE_FONT);
+    }
     String formattedPath = Utils.addWordBreaks(
         formatter.getFormattedText(
             Message.raw(getPath(new File(getInstancePath())))).toString(),
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
index 8fa59a4..b773a83 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
+ *      Portions Copyright 2011 ForgeRock AS
  */
 
 package org.opends.quicksetup.installer.offline;
@@ -443,7 +444,7 @@
    */
   protected void initMaps()
   {
-    initSummaryMap(hmSummary);
+    initSummaryMap(hmSummary, true);
 
     /*
      * hmTime contains the relative time that takes for each task to be
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
index d8f89cd..fa7244e 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
+ *      Portions Copyright 2011 ForgeRock AS
  */
 
 package org.opends.quicksetup.installer.webstart;
@@ -359,7 +360,7 @@
    */
   private void initMaps()
   {
-    initSummaryMap(hmSummary);
+    initSummaryMap(hmSummary, false);
 
     /*
      * hmTime contains the relative time that takes for each task to be

--
Gitblit v1.10.0