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

Matthew Swift
25.04.2013 92763bf06494952b24b13915d71aa541bf590ffc
Simple fix: avoid appending redundant ":" to ErrorResultException error message when there is no LDAP diagnostic message.
1 files modified
12 ■■■■ changed files
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ErrorResultException.java 12 ●●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ErrorResultException.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS.
 *      Portions copyright 2011-2013 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -184,6 +184,14 @@
        return new ErrorResultException(result);
    }
    private static String getMessage(final Result result) {
        if (result.getDiagnosticMessage() == null || result.getDiagnosticMessage().isEmpty()) {
            return result.getResultCode().toString();
        } else {
            return result.getResultCode() + ": " + result.getDiagnosticMessage();
        }
    }
    private final Result result;
    /**
@@ -193,7 +201,7 @@
     *            The error result.
     */
    protected ErrorResultException(final Result result) {
        super(result.getResultCode() + ": " + result.getDiagnosticMessage(), result.getCause());
        super(getMessage(result), result.getCause());
        this.result = result;
    }