From 6f12c87fe1373694362258dbf19faf63894fe0cc Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 03 Mar 2009 18:15:30 +0000
Subject: [PATCH] Fix for issue 3840 (org.opends.quicksetup.LicenseFile breaks Java Web Start installer)

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java |   51 +++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java
index 0938c62..1cdc5df 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java
@@ -30,7 +30,8 @@
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
-import org.opends.server.core.DirectoryServer;
+
+import org.opends.quicksetup.util.Utils;
 
 /**
  * Represents information about the license file.
@@ -53,21 +54,36 @@
    */
   static private String getName()
   {
-    String installRootFromSystem = DirectoryServer.getServerRoot();
-
-    if (installRootFromSystem == null) {
-      installRootFromSystem = System.getenv("INSTALL_ROOT");
+    if (Utils.isWebStart())
+    {
+      return
+      File.pathSeparator +
+      "Legal" +
+      File.pathSeparator +
+      "license_to_accept.txt";
     }
+    else
+    {
+      // NOTE: make a whole reference to the package of DirectoryServer
+      // instead of using an import clause.  Using an import breaks the
+      // Java Web Start installer.
+      String installRootFromSystem =
+        org.opends.server.core.DirectoryServer.getServerRoot();
 
-    if (installRootFromSystem == null) {
-      installRootFromSystem = "";
+      if (installRootFromSystem == null) {
+        installRootFromSystem = System.getenv("INSTALL_ROOT");
+      }
+
+      if (installRootFromSystem == null) {
+        installRootFromSystem = "";
+      }
+
+      return installRootFromSystem +
+      File.pathSeparator +
+      "Legal" +
+      File.pathSeparator +
+      "license_to_accept.txt";
     }
-
-    return installRootFromSystem +
-            File.pathSeparator +
-            "Legal" +
-            File.pathSeparator +
-            "license_to_accept.txt";
   }
 
   /**
@@ -91,7 +107,14 @@
    */
   static public boolean exists()
   {
-    return getFile().exists();
+    if (Utils.isWebStart())
+    {
+      return false;
+    }
+    else
+    {
+      return getFile().exists();
+    }
   }
 
 

--
Gitblit v1.10.0