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

dugan
29.19.2006 0d6c47daf12ae94aec0f633e22552f553ec5d4df
Fix null pointer exception handling
1 files modified
36 ■■■■ changed files
opends/src/server/org/opends/server/config/JMXMBean.java 36 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/config/JMXMBean.java
@@ -1213,30 +1213,28 @@
  }
  /**
   * Get the client connection to use.
   * Get the client JMX connection to use. Returns null if an Exception is caught or if
   * the AccessControlContext subject is null.
   *
   * @return The JmxClientConnection
   * @return The JmxClientConnection.
   */
  private JmxClientConnection getClientConnection()
  {
    java.security.AccessControlContext acc = java.security.AccessController
        .getContext();
    javax.security.auth.Subject subject = javax.security.auth.Subject
        .getSubject(acc);
    try
    {
      Set privateCreds = subject.getPrivateCredentials(Credential.class);
      JmxClientConnection jmxClientConnection = ((Credential) privateCreds
          .iterator().next()).getClientConnection();
      JmxClientConnection jmxClientConnection=null;
      java.security.AccessControlContext acc = java.security.AccessController
      .getContext();
      try
      {
          javax.security.auth.Subject subject = javax.security.auth.Subject
          .getSubject(acc);
          if(subject != null) {
              Set privateCreds = subject.getPrivateCredentials(Credential.class);
              jmxClientConnection = ((Credential) privateCreds
                      .iterator().next()).getClientConnection();
          }
      }
      catch (Exception e) {}
      return jmxClientConnection;
    }
    catch (Exception e)
    {
      return null;
    }
  }
}