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

lutoff
29.38.2009 fef8fc7d514743391fd93aae74e2b9db20e59baf
opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -28,6 +28,8 @@
package org.opends.quicksetup.upgrader;
import org.opends.quicksetup.CliApplication;
import org.opends.quicksetup.LicenseFile;
import static org.opends.quicksetup.Installation.*;
import static org.opends.messages.QuickSetupMessages.*;
@@ -72,12 +74,14 @@
import org.opends.server.tools.JavaPropertiesTool;
import java.awt.event.WindowEvent;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileFilter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.Proxy;
@@ -814,6 +818,64 @@
      checkAbort();
      // Check license
      if (!LicenseFile.isAlreadyApproved())
      {
        String installRootFromSystem = System.getProperty("INSTALL_ROOT");
        System.setProperty("INSTALL_ROOT", installRootFromSystem
            + File.separator + "tmp" + File.separator + "upgrade");
        if (LicenseFile.exists())
        {
          String licenseString = LicenseFile.getText();
          System.out.println(licenseString);
          if (getUserData().isInteractive())
          {
            // If the user asks for no-prompt. We just display the license text.
            // User doesn't asks for no-prompt. We just display the license text
            // and force to accept it.
            String yes = INFO_LICENSE_CLI_ACCEPT_YES.get().toString();
            String no = INFO_LICENSE_CLI_ACCEPT_NO.get().toString();
            System.out.println(INFO_LICENSE_DETAILS_LABEL.get().toString());
            BufferedReader in = new BufferedReader(new InputStreamReader(
                System.in));
            while (true)
            {
              System.out.print(INFO_LICENSE_CLI_ACCEPT_QUESTION
                  .get(yes, no, no).toString());
              try
              {
                String response = in.readLine();
                if ((response == null)
                    || (response.toLowerCase().equals(no.toLowerCase()))
                    || (response.length() == 0))
                {
                  System.exit(ReturnCode.CANCELLED.getReturnCode());
                }
                else if (response.toLowerCase().equals(yes.toLowerCase()))
                {
                  // create the file
                  LicenseFile.setApproval(true);
                  LicenseFile.createFileLicenseApproved();
                  break;
                }
                else
                {
                  System.out.println(INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE
                      .get().toString());
                }
              }
              catch (IOException e)
              {
                System.out.println(INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE
                    .get().toString());
              }
            }
          }
        }
        System.setProperty("INSTALL_ROOT", installRootFromSystem);
      }
      if (!Utils.isWebStart())
      {
        // The command-line upgrade has not the option of leaving the server