mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Violette Roche-Montane
05.07.2013 32cbf759d710066e0444b52678de716f8c2c6cd6
CR-1962 OPENDJ-1048 OpenDJ QuickSetup creates the "licenseAccepted" file in the wrong place
3 files modified
60 ■■■■■ changed files
opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java 54 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java 4 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java 2 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/LicenseFile.java
@@ -42,9 +42,8 @@
import org.opends.server.util.StaticUtils;
/**
 * Represents information about the license file.
 *
 * NOTE: the license file location must be kept in sync with build.xml and
 * Represents information about the license file. NOTE: the license file
 * location must be kept in sync with build.xml and
 * org.opends.server.tools.upgrade.LicenseFile.
 */
public class LicenseFile
@@ -68,28 +67,6 @@
  /**
   * Get the directory in which legal files are stored.
   */
  private static String getLegalDirectory()
  {
    String installRootFromSystem = System.getProperty("INSTALL_ROOT");
    if (installRootFromSystem == null)
    {
      installRootFromSystem = System.getenv("INSTALL_ROOT");
    }
    if (installRootFromSystem == null)
    {
      installRootFromSystem = "";
    }
    return installRootFromSystem + File.separatorChar + LEGAL_FOLDER_NAME;
  }
  /**
   * Get the directory in which legal files are stored.
   */
  private static String getInstanceLegalDirectory()
  {
    String instanceLegalDirName;
@@ -131,7 +108,8 @@
   */
  static private String getName()
  {
    return getLegalDirectory() + File.separatorChar + LICENSE_FILE_NAME;
    return getInstanceLegalDirectory() + File.separatorChar
        + LICENSE_FILE_NAME;
  }
  /**
@@ -152,8 +130,8 @@
   */
  static private URL getWebStartLicenseFile()
  {
    final String licenseResource = LEGAL_FOLDER_NAME + File.separatorChar
        + LICENSE_FILE_NAME;
    final String licenseResource =
        LEGAL_FOLDER_NAME + File.separatorChar + LICENSE_FILE_NAME;
    return Thread.currentThread().getContextClassLoader().getResource(
        licenseResource);
  }
@@ -161,9 +139,9 @@
  /**
   * Checks if the license file exists.
   *
   * @return <CODE>true</CODE> if the license file exists
   *         in the Legal directory in the top level installation directory
   *         <CODE>false</CODE> otherwise.
   * @return <CODE>true</CODE> if the license file exists in the Legal directory
   *         in the top level installation directory <CODE>false</CODE>
   *         otherwise.
   */
  static public boolean exists()
  {
@@ -267,16 +245,20 @@
  }
  /**
   * Create a file which indicates that the license has been approved.
   * Creates a file - in the legal folder from the specified directory; which
   * indicates that the license has been approved.
   *
   * @param installationPath
   *          The server installation's path.
   */
  static public void createFileLicenseApproved()
  static public void createFileLicenseApproved(final String installationPath)
  {
    if (getApproval())
    if (getApproval() && installationPath != null)
    {
      try
      {
        new File(getInstanceLegalDirectory() + File.separatorChar
            + ACCEPTED_LICENSE_FILE_NAME).createNewFile();
        new File(installationPath + File.separatorChar + LEGAL_FOLDER_NAME
            + File.separatorChar + ACCEPTED_LICENSE_FILE_NAME).createNewFile();
      }
      catch (IOException e)
      {
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2013 ForgeRock AS
 */
package org.opends.quicksetup.installer.offline;
@@ -110,7 +110,7 @@
      checkAbort();
      // create license accepted file
      LicenseFile.createFileLicenseApproved();
      LicenseFile.createFileLicenseApproved(this.getInstallationPath());
      checkAbort() ;
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -158,7 +158,7 @@
      checkAbort();
      // create license accepted file
      LicenseFile.createFileLicenseApproved();
      LicenseFile.createFileLicenseApproved(this.getInstallationPath());
      createData();