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

jvergara
05.19.2007 cca539a060ac6f7216304a54aa1d2b7a64ce5797
Fix for issue 2059.

Mark the panels as non opaque to avoid having the white box in certain windows environments.

Instead of simulating a click on the OK button when the user accepts the certificate, directly call the method invoked when the button is clicked. This avoids having issues with focus, that actually make the button click to be ignored.

Use hexadecimal representation of the certificate instead of the address of the byte array.
2 files modified
47 ■■■■■ changed files
opends/src/quicksetup/org/opends/quicksetup/ui/CertificateDialog.java 38 ●●●●● patch | view | raw | blame | history
opends/src/statuspanel/org/opends/statuspanel/ui/LoginDialog.java 9 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/CertificateDialog.java
@@ -205,7 +205,8 @@
        certificateDetails.getPreferredSize().width), gbc);
    gbc.insets.top = 0;
    gbc.weighty = 1.0;
    JPanel auxPanel = new JPanel(new GridBagLayout());
    JPanel auxPanel = UIFactory.makeJPanel();
    auxPanel.setLayout(new GridBagLayout());
    gbc.weightx = 0.0;
    gbc.insets = UIFactory.getEmptyInsets();
    gbc.gridwidth = GridBagConstraints.RELATIVE;
@@ -235,9 +236,9 @@
   */
  private Component createTitlePanel()
  {
    JPanel titlePanel = new JPanel(new GridBagLayout());
    JPanel titlePanel = UIFactory.makeJPanel();
    titlePanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    titlePanel.setOpaque(false);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 0.0;
@@ -279,8 +280,8 @@
      text = getMsg("certificate-name-mismatch-text",
          ce.getHost(), String.valueOf(ce.getPort()));
    }
    JPanel p = new JPanel(new GridBagLayout());
    p.setOpaque(false);
    JPanel p = UIFactory.makeJPanel();
    p.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = GridBagConstraints.RELATIVE;
    gbc.anchor = GridBagConstraints.NORTHWEST;
@@ -318,8 +319,8 @@
   */
  private Component createButtonsPanel()
  {
    JPanel buttonsPanel = new JPanel(new GridBagLayout());
    buttonsPanel.setOpaque(false);
    JPanel buttonsPanel = UIFactory.makeJPanel();
    buttonsPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridwidth = 4;
@@ -369,8 +370,8 @@
   */
  private JComponent createCertificateDetailsPane()
  {
    JPanel p = new JPanel(new GridBagLayout());
    p.setOpaque(false);
    JPanel p = UIFactory.makeJPanel();
    p.setLayout(new GridBagLayout());
    if ((ce.getChain() != null) && (ce.getChain().length > 0))
    {
      final JComboBox combo = new JComboBox();
@@ -409,7 +410,8 @@
            createVersionComponent(cert),
            createPublicKeyComponent(cert)
        };
        JPanel certPanel = new JPanel(new GridBagLayout());
        JPanel certPanel = UIFactory.makeJPanel();
        certPanel.setLayout(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.anchor = GridBagConstraints.NORTHWEST;
        gbc.fill = GridBagConstraints.HORIZONTAL;
@@ -454,7 +456,8 @@
        gbc.anchor = GridBagConstraints.WEST;
        gbc.gridwidth = 3;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        JPanel auxPanel = new JPanel(new GridBagLayout());
        JPanel auxPanel = UIFactory.makeJPanel();
        auxPanel.setLayout(new GridBagLayout());
        JLabel l = UIFactory.makeJLabel(UIFactory.IconType.NO_ICON,
            getMsg("certificate-chain-label"),
            UIFactory.TextStyle.PRIMARY_FIELD_VALID);
@@ -574,8 +577,17 @@
  private JComponent createSignatureComponent(X509Certificate cert)
  {
    String signature = String.valueOf(cert.getSignature());
    return makeValueLabel(signature);
    byte[] sig = cert.getSignature();
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < sig.length; i++)
    {
      if (i > 0)
      {
        sb.append(":");
      }
      sb.append(Integer.toHexString(((int) sig[i]) & 0xFF));
    }
    return makeValueLabel(sb.toString());
  }
  private JComponent createSignatureAlgorithmComponent(X509Certificate cert)
opends/src/statuspanel/org/opends/statuspanel/ui/LoginDialog.java
@@ -355,7 +355,8 @@
  {
    BackgroundTask worker = new BackgroundTask()
    {
      public Object processBackgroundTask() throws NamingException
      public Object processBackgroundTask() throws NamingException,
      ConfigException
      {
        Boolean isServerRunning = Boolean.TRUE;
        InitialLdapContext ctx = null;
@@ -472,7 +473,7 @@
            throw ne;
          }
          isServerRunning = Boolean.FALSE;
        } catch (Error e)
        } catch (ConfigException e)
        {
          throw e;
        } catch (IllegalStateException ise)
@@ -779,12 +780,12 @@
      {
        LOG.log(Level.INFO, "Accepting certificate presented by host "+host);
        getTrustManager().acceptCertificate(chain, authType, host);
        /* Simulate a click on the OK */
        /* Simulate a click on the OK by calling in the okClicked method. */
        SwingUtilities.invokeLater(new Runnable()
        {
          public void run()
          {
            okButton.doClick();
            okClicked();
          }
        });
      }