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

Jean-Noel Rouvignac
18.27.2014 a4836cb338da19b834b1e6a31a70453b24427c08
OPENDJ-1635 SNMP: fail to get dsServerDescription value

SNMP's dsServerDescription determines the install path from the location of bootstrap-client.jar, extracted from the class path.
However, start-ds command uses bootstrap.jar in the classpath instead of bootstrap-client.jar (which is for the tools).
The fix consists in verifying the location for both boostrap.jar and boostrap-client.jar in the classpath.


Installation.java:
Changed OPENDJ_BOOTSTRAP_JAR_RELATIVE_PATH to refer to bootstrap.jar.
Added OPENDJ_BOOTSTRAP_CLIENT_JAR_RELATIVE_PATH constant.

Utils.java, Utilities.java:
In getInstallPath(), added checks for both OPENDJ_BOOTSTRAP_JAR_RELATIVE_PATH and OPENDJ_BOOTSTRAP_CLIENT_JAR_RELATIVE_PATH.
3 files modified
15 ■■■■■ changed files
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java 6 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/Installation.java 5 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/Utils.java 4 ●●● patch | view | raw | blame | history
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
@@ -134,6 +134,7 @@
import static org.opends.admin.ads.util.ConnectionUtils.*;
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.quicksetup.Installation.*;
import static org.opends.server.types.CommonSchemaElements.*;
/**
@@ -1918,8 +1919,9 @@
  {
    for (String classPath : classPaths)
    {
      String normPath = classPath.replace(File.separatorChar, '/');
      if (normPath.endsWith(Installation.OPENDJ_BOOTSTRAP_JAR_RELATIVE_PATH))
      final String normPath = classPath.replace(File.separatorChar, '/');
      if (normPath.endsWith(OPENDJ_BOOTSTRAP_CLIENT_JAR_RELATIVE_PATH)
          || normPath.endsWith(OPENDJ_BOOTSTRAP_JAR_RELATIVE_PATH))
      {
        return classPath;
      }
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/Installation.java
@@ -54,8 +54,9 @@
{
  /** Relative path to bootstrap OpenDJ jar file. */
  public static final String OPENDJ_BOOTSTRAP_JAR_RELATIVE_PATH =
      "lib/bootstrap-client.jar";
  public static final String OPENDJ_BOOTSTRAP_JAR_RELATIVE_PATH = "lib/bootstrap.jar";
  /** Relative path to bootstrap-client OpenDJ jar file. */
  public static final String OPENDJ_BOOTSTRAP_CLIENT_JAR_RELATIVE_PATH = "lib/bootstrap-client.jar";
  /**
   * The relative path where all the Windows binaries (batch files) are.
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -66,6 +66,7 @@
import static org.forgerock.util.Utils.*;
import static org.opends.admin.ads.util.ConnectionUtils.*;
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.quicksetup.Installation.*;
import static org.opends.server.util.DynamicConstants.*;
/**
@@ -831,7 +832,8 @@
    for (String classPath : classPaths)
    {
      final String normPath = classPath.replace(File.separatorChar, '/');
      if (normPath.endsWith(Installation.OPENDJ_BOOTSTRAP_JAR_RELATIVE_PATH))
      if (normPath.endsWith(OPENDJ_BOOTSTRAP_CLIENT_JAR_RELATIVE_PATH)
          || normPath.endsWith(OPENDJ_BOOTSTRAP_JAR_RELATIVE_PATH))
      {
        return classPath;
      }