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

jvergara
02.34.2008 bc82470675b2f920877b924003ca09bd36ee4c61
Fix for issue 3220 (uninstall raises "Failing checking the port: java.lang.NullPointerException")

When we are in non-interactive mode of the CLI, initialize properly the contents of the UninstallUserData object.
1 files modified
46 ■■■■ changed files
opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java 46 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -97,6 +97,8 @@
  private LDAPConnectionConsoleInteraction ci = null;
  private ConfigFromFile conf;
  /**
   * Default constructor.
   */
@@ -222,20 +224,39 @@
    if ((referencedHostName == null) && !args.isInteractive())
    {
      referencedHostName = args.getDefaultReferencedHostName();
      try
      {
        UninstallData d = new UninstallData(Installation.getLocal());
        userData.setReplicationServer(
            referencedHostName+":"+d.getReplicationServerPort());
        userData.setReferencedHostName(referencedHostName);
      }
      catch (Throwable t)
      {
        LOG.log(Level.SEVERE, "Could not create UninstallData: "+t, t);
      }
    }
    try
    {
      UninstallData d = new UninstallData(Installation.getLocal());
      userData.setReplicationServer(
          referencedHostName+":"+d.getReplicationServerPort());
    }
    catch (Throwable t)
    {
      LOG.log(Level.SEVERE, "Could not create UninstallData: "+t, t);
      userData.setReplicationServer(
          referencedHostName+":8989");
    }
    userData.setUseSSL(parser.useSSL());
    userData.setUseStartTLS(parser.useStartTLS());
    conf = new ConfigFromFile();
    conf.readConfiguration();
    try
    {
      String ldapUrl = conf.getURL(
        ConnectionProtocolPolicy.getConnectionPolicy(parser.useSSL(),
            parser.useStartTLS()));
      userData.setLocalServerUrl(ldapUrl);
    }
    catch (ConfigException ce)
    {
      LOG.log(Level.WARNING,
          "Error retrieving a valid LDAP URL in conf file: "+ce, ce);
      println();
      println(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
      println();
    }
    userData.setReferencedHostName(referencedHostName);
    /*
     * Step 4: check if server is running.  Depending if it is running and the
@@ -731,8 +752,6 @@
    boolean useStartTLS = userData.useStartTLS();
    boolean couldConnect = false;
    ConfigFromFile conf = new ConfigFromFile();
    conf.readConfiguration();
    boolean canUseSSL = conf.getLDAPSURL() != null;
    boolean canUseStartTLS = conf.getStartTLSURL() != null;
@@ -1108,6 +1127,7 @@
          "Error retrieving a valid LDAP URL in conf file: "+ce, ce);
      println();
      println(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
      userData.setLocalServerUrl("ldap://localhost:389");
    }
    catch (NamingException ne)
    {