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

jvergara
23.44.2009 12528a2548d419b1d48d1ec70f0f9ae3a94c0b20
Fix for issue 4313 (Control-panel stop triggers authentication pop-up)
After getting the return code from stop-ds, verify that the server released its lock on the file used to test that it is running.

Made some improvements in the way the focus is initialized in the login panel.
7 files modified
121 ■■■■ changed files
opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java 1 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/task/StartStopTask.java 29 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/task/StopServerTask.java 55 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/GenericDialog.java 6 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/GenericFrame.java 2 ●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java 14 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/admin_tool.properties 14 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
@@ -105,7 +105,6 @@
  private LinkedHashSet<ConfigChangeListener> configListeners =
    new LinkedHashSet<ConfigChangeListener>();
  private LinkedHashSet<BackupCreatedListener> backupListeners =
    new LinkedHashSet<BackupCreatedListener>();
opends/src/guitools/org/opends/guitools/controlpanel/task/StartStopTask.java
@@ -38,7 +38,7 @@
import org.opends.messages.Message;
/**
 * An abstract class used to refactor some code between the start, stop and
 * An abstract class used to re-factor some code between the start, stop and
 * restart tasks.
 *
 */
@@ -98,8 +98,8 @@
    // To display new status
    try
    {
      getInfo().regenerateDescriptor();
      getInfo().stopPooling();
      getInfo().regenerateDescriptor();
      ArrayList<String> arguments = getCommandLineArguments();
@@ -108,14 +108,7 @@
      arguments.toArray(args);
      returnCode = executeCommandLine(getCommandLinePath(), args);
      if (returnCode != 0)
      {
        state = State.FINISHED_WITH_ERROR;
      }
      else
      {
        state = State.FINISHED_SUCCESSFULLY;
      }
      postCommandLine();
    }
    catch (Throwable t)
    {
@@ -133,4 +126,20 @@
    ArrayList<String> args = new ArrayList<String>();
    return args;
  }
  /**
   * Method called just after calling the command-line.  To be overwritten
   * by the inheriting classes.
   */
  protected void postCommandLine()
  {
    if (returnCode != 0)
    {
      state = State.FINISHED_WITH_ERROR;
    }
    else
    {
      state = State.FINISHED_SUCCESSFULLY;
    }
  }
}
opends/src/guitools/org/opends/guitools/controlpanel/task/StopServerTask.java
@@ -29,6 +29,8 @@
import static org.opends.messages.AdminToolMessages.*;
import java.io.File;
import javax.swing.SwingUtilities;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
@@ -79,6 +81,7 @@
    super.runTask();
    if (state == State.FINISHED_SUCCESSFULLY)
    {
      // Verify that the server is actually stopped
      SwingUtilities.invokeLater(new Runnable()
      {
        public void run()
@@ -98,4 +101,56 @@
  {
    return getCommandLinePath("stop-ds");
  }
  /**
   * Method called just after calling the command-line.  To be overwritten
   * by the inheriting classes.
   */
  protected void postCommandLine()
  {
    if (returnCode != 0)
    {
      state = State.FINISHED_WITH_ERROR;
    }
    else
    {
      File f = new File(getInfo().getServerDescriptor().getInstancePath());
      // Check that the server is actually stopped.
      boolean stopped = !Utilities.isServerRunning(f);
      int nTries = 20;
      while (!stopped && nTries > 0)
      {
        try
        {
          Thread.sleep(700);
        }
        catch (Throwable t)
        {
        }
        stopped = !Utilities.isServerRunning(f);
        nTries --;
      }
      if (!stopped)
      {
        SwingUtilities.invokeLater(new Runnable()
        {
          public void run()
          {
            getProgressDialog().appendProgressHtml(
                Utilities.applyFont(
                    "<br>"+
                    ERR_CTRL_PANEL_STOPPING_SERVER_POST_CMD_LINE.get(
                        getCommandLinePath("stop-ds"))+"<br>",
                        ColorAndFontConstants.progressFont));
          }
        });
        returnCode = -1;
        state = State.FINISHED_WITH_ERROR;
      }
      else
      {
        state = State.FINISHED_SUCCESSFULLY;
      }
    }
  }
}
opends/src/guitools/org/opends/guitools/controlpanel/ui/GenericDialog.java
@@ -234,13 +234,17 @@
   */
  public void setVisible(boolean visible)
  {
    if (lastComponentWithFocus == null)
    if (visible && lastComponentWithFocus == null)
    {
      lastComponentWithFocus = panel.getPreferredFocusComponent();
    }
    if (visible && (lastComponentWithFocus != null) &&
        lastComponentWithFocus.isVisible())
    {
      if (lastComponentWithFocus == null)
      {
        lastComponentWithFocus = panel.getPreferredFocusComponent();
      }
      lastComponentWithFocus.requestFocusInWindow();
    }
    updateDefaultButton(panel);
opends/src/guitools/org/opends/guitools/controlpanel/ui/GenericFrame.java
@@ -210,7 +210,7 @@
   */
  public void setVisible(boolean visible)
  {
    if (lastComponentWithFocus == null)
    if (visible && lastComponentWithFocus == null)
    {
      lastComponentWithFocus = panel.getPreferredFocusComponent();
    }
opends/src/guitools/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java
@@ -261,7 +261,14 @@
   */
  public Component getPreferredFocusComponent()
  {
    return pwd;
    if (pwd.isVisible())
    {
      return pwd;
    }
    else
    {
      return combo;
    }
  }
  /**
@@ -302,6 +309,11 @@
        {
          updateComponentState();
          displayMainPanel();
          Component comp = getPreferredFocusComponent();
          if (comp != null)
          {
            comp.requestFocusInWindow();
          }
        }
      };
      displayMessage(INFO_CTRL_PANEL_LOADING_PANEL_SUMMARY.get());
opends/src/messages/messages/admin_tool.properties
@@ -1206,23 +1206,25 @@
INFO_CTRL_PANEL_STARTING_SERVER_SUCCESSFUL_DETAILS=The server started \
 successfully
MILD_ERR_CTRL_PANEL_STARTING_SERVER_ERROR_SUMMARY=Error during server start
MILD_ERR_CTRL_PANEL_STARTING_SERVER_ERROR_DETAILS=An error starting the \
 server.  Error code: %d
MILD_ERR_CTRL_PANEL_STARTING_SERVER_ERROR_DETAILS=An error occurred starting \
 the server.  Error code: %d
INFO_CTRL_PANEL_RESTARTING_SERVER_SUCCESSFUL_SUMMARY=Restart Complete
INFO_CTRL_PANEL_RESTARTING_SERVER_SUCCESSFUL_DETAILS=The server restarted \
 successfully
MILD_ERR_CTRL_PANEL_RESTARTING_SERVER_ERROR_SUMMARY=Error during server restart
MILD_ERR_CTRL_PANEL_RESTARTING_SERVER_ERROR_DETAILS=An error restarting the \
 server.  Error code: %d
MILD_ERR_CTRL_PANEL_RESTARTING_SERVER_ERROR_DETAILS=An error occurred \
 restarting the server.  Error code: %d
INFO_CTRL_PANEL_STOPPING_SERVER_SUMMARY=Stopping Server...
INFO_CTRL_PANEL_STOPPING_SERVER_SUCCESSFUL_SUMMARY=Stop Complete
INFO_CTRL_PANEL_STOPPING_SERVER_SUCCESSFUL_DETAILS=The server stopped \
 successfully
MILD_ERR_CTRL_PANEL_STOPPING_SERVER_ERROR_SUMMARY=Error during Server Stop
MILD_ERR_CTRL_PANEL_STOPPING_SERVER_ERROR_DETAILS=An error stopping the \
 server.  Error code: %d
MILD_ERR_CTRL_PANEL_STOPPING_SERVER_ERROR_DETAILS=An error occurred stopping \
 the server.  Error code: %d
MILD_ERR_CTRL_PANEL_STOPPING_SERVER_POST_CMD_LINE=The command-line %s returned \
 successfully but the server appears to be running.
INFO_CTRL_PANEL_CLOSE_WINDOW_WHEN_OPERATION_COMPLETES_LABEL=Close window when \
 operation completes