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

jvergara
23.31.2007 72109e4cedca076573dc7d11c082f37c2ce1044d
Fix for issue 2318.

In some cases calling UIManager seems to make the JVM to exit (for instance if it cannot ge the display in some special scenarios). The fix consists of not calling the UIManager code if we are in CLI mode.
1 files modified
28 ■■■■■ changed files
opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java 28 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
@@ -28,6 +28,7 @@
package org.opends.quicksetup.ui;
import org.opends.messages.Message;
import org.opends.quicksetup.util.Utils;
import static org.opends.messages.QuickSetupMessages.*;
@@ -531,19 +532,22 @@
      new HashMap<IconType, ImageIcon>();
  static {
    try
    if (!Utils.isCli())
    {
      UIManager.put("OptionPane.background",
          getColor(INFO_OPTIONPANE_BACKGROUND_COLOR.get()));
      UIManager.put("Panel.background",
          getColor(INFO_PANEL_BACKGROUND_COLOR.get()));
      UIManager.put("ComboBox.background",
          getColor(INFO_COMBOBOX_BACKGROUND_COLOR.get()));
    }
    catch (Throwable t)
    {
      // This might occur when we do not get the display
      LOG.log(Level.WARNING, "Error updating UIManager: "+t, t);
      try
      {
        UIManager.put("OptionPane.background",
            getColor(INFO_OPTIONPANE_BACKGROUND_COLOR.get()));
        UIManager.put("Panel.background",
            getColor(INFO_PANEL_BACKGROUND_COLOR.get()));
        UIManager.put("ComboBox.background",
            getColor(INFO_COMBOBOX_BACKGROUND_COLOR.get()));
      }
      catch (Throwable t)
      {
        // This might occur when we do not get the display
        LOG.log(Level.WARNING, "Error updating UIManager: "+t, t);
      }
    }
  }