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

Jean-Noel Rouvignac
21.09.2014 b9e8d5ed3125cefd113cce1733810b09882c9604
AutoRefactored Strings.
5 files modified
57 ■■■■■ changed files
opendj-cli/src/main/java/com/forgerock/opendj/cli/PromptingTrustManager.java 6 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/EnumPropertyDefinition.java 7 ●●●●● patch | view | raw | blame | history
opendj-config/src/test/java/org/forgerock/opendj/config/ValidateConfigDefinitionsTest.java 9 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/MemoryBackend.java 17 ●●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxTest.java 18 ●●●●● patch | view | raw | blame | history
opendj-cli/src/main/java/com/forgerock/opendj/cli/PromptingTrustManager.java
@@ -285,8 +285,7 @@
                    onDiskTrustStore.setCertificateEntry(alias, aChain);
                }
            } catch (final Exception e) {
                LOG.warn(LocalizableMessage.raw("Error setting certificate to store: " + e + "\nCert: "
                        + aChain.toString()));
                LOG.warn(LocalizableMessage.raw("Error setting certificate to store: " + e + "\nCert: " + aChain));
            }
        }
@@ -374,9 +373,8 @@
            case UNTRUSTED:
                if (exception instanceof CertificateException) {
                    throw (CertificateException) exception;
                } else {
                    throw new CertificateException(exception);
                }
                throw new CertificateException(exception);
            case CERTIFICATE_DETAILS:
                for (final X509Certificate aChain : chain) {
                    app.println();
opendj-config/src/main/java/org/forgerock/opendj/config/EnumPropertyDefinition.java
@@ -147,11 +147,10 @@
        String nvalue = value.trim().toLowerCase();
        E eValue = decodeMap.get(nvalue);
        if (eValue == null) {
            throw PropertyException.illegalPropertyValueException(this, value);
        } else {
        if (eValue != null) {
            return eValue;
        }
        throw PropertyException.illegalPropertyValueException(this, value);
    }
    /**
@@ -189,7 +188,7 @@
     */
    public final LocalizableMessage getValueSynopsis(Locale locale, E value) {
        ManagedObjectDefinitionI18NResource resource = ManagedObjectDefinitionI18NResource.getInstance();
        String property = "property." + getName() + ".syntax.enumeration.value." + value.toString() + ".synopsis";
        String property = "property." + getName() + ".syntax.enumeration.value." + value + ".synopsis";
        try {
            return resource.getMessage(getManagedObjectDefinition(), property, locale);
        } catch (MissingResourceException e) {
opendj-config/src/test/java/org/forgerock/opendj/config/ValidateConfigDefinitionsTest.java
@@ -36,12 +36,13 @@
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.ObjectClass;
import org.forgerock.opendj.ldap.schema.Schema;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
@SuppressWarnings("javadoc")
@Test(singleThreaded = true)
public class ValidateConfigDefinitionsTest extends ConfigTestCase {
@@ -103,10 +104,8 @@
            validatePropertyDefinition(objectDef, configObjectClass, propDef, errors);
        }
        if (errors.length() > 0) {
            Assert.fail("The configuration definition for " + objectDef.getName() + " has the following problems: "
                + EOL + errors.toString());
        }
        assertTrue(errors.length() != 0,
                "The configuration definition for " + objectDef.getName() + " has the following problems: " + EOL + errors);
    }
    /** Exceptions to properties ending in -class being exactly 'java-class'. */
opendj-core/src/main/java/org/forgerock/opendj/ldap/MemoryBackend.java
@@ -238,8 +238,7 @@
                final DN dn = request.getName();
                final DN parent = dn.parent();
                if (entries.containsKey(dn)) {
                    throw newLdapException(ResultCode.ENTRY_ALREADY_EXISTS, "The entry '"
                            + dn.toString() + "' already exists");
                    throw newLdapException(ResultCode.ENTRY_ALREADY_EXISTS, "The entry '" + dn + "' already exists");
                } else if (!entries.containsKey(parent)) {
                    noSuchObject(parent);
                } else {
@@ -269,8 +268,7 @@
                    password = ((GenericBindRequest) request).getAuthenticationValue();
                } else {
                    throw newLdapException(ResultCode.PROTOCOL_ERROR,
                            "non-SIMPLE authentication not supported: "
                                    + request.getAuthenticationType());
                            "non-SIMPLE authentication not supported: " + request.getAuthenticationType());
                }
                entry = getRequiredEntry(null, username);
                if (!entry.containsAttribute("userPassword", password)) {
@@ -286,8 +284,7 @@
             * one here because the memory back-end is not intended for
             * production use.
             */
            resultHandler.handleError(newLdapException(ResultCode.INVALID_CREDENTIALS,
                    "Unknown user"));
            resultHandler.handleError(newLdapException(ResultCode.INVALID_CREDENTIALS, "Unknown user"));
        } catch (final LdapException e) {
            resultHandler.handleError(e);
        }
@@ -606,9 +603,8 @@
                final Filter filter = control.getFilter();
                final Matcher matcher = filter.matcher(schema);
                if (!matcher.matches(entry).toBoolean()) {
                    throw newLdapException(ResultCode.ASSERTION_FAILED, "The filter '"
                            + filter.toString() + "' did not match the entry '"
                            + entry.getName().toString() + "'");
                    throw newLdapException(ResultCode.ASSERTION_FAILED,
                            "The filter '" + filter + "' did not match the entry '" + entry.getName() + "'");
                }
            }
        }
@@ -620,8 +616,7 @@
    }
    private void noSuchObject(final DN dn) throws LdapException {
        throw newLdapException(ResultCode.NO_SUCH_OBJECT, "The entry '" + dn.toString()
                + "' does not exist");
        throw newLdapException(ResultCode.NO_SUCH_OBJECT, "The entry '" + dn + "' does not exist");
    }
    private boolean sendEntry(final AttributeFilter filter,
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxTest.java
@@ -33,7 +33,7 @@
import org.testng.annotations.Test;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_CERTIFICATE_OID;
import static org.testng.Assert.fail;
import static org.testng.Assert.*;
/**
 * Certificate syntax tests.
@@ -104,18 +104,15 @@
     *            The expected result of the test
     */
    @Test(dataProvider = "acceptableValues")
    public void testAcceptableValues(ByteString value, Boolean result) {
    public void testAcceptableValues(ByteString value, boolean result) {
        // Make sure that the specified class can be instantiated as a task.
        final Syntax syntax = getRule();
        final LocalizableMessageBuilder reason = new LocalizableMessageBuilder();
        // test the valueIsAcceptable method
        final Boolean liveResult = syntax.valueIsAcceptable(value, reason);
        if (liveResult != result) {
            fail(syntax + ".valueIsAcceptable gave bad result for " + value.toString() + "reason : " + reason);
        }
        final boolean liveResult = syntax.valueIsAcceptable(value, reason);
        assertEquals(liveResult, result, syntax + ".valueIsAcceptable gave bad result for " + value + "reason : " + reason);
        // call the getters
        syntax.getApproximateMatchingRule();
@@ -146,11 +143,8 @@
        final LocalizableMessageBuilder reason = new LocalizableMessageBuilder();
        // test the valueIsAcceptable method
        final Boolean liveResult = syntax.valueIsAcceptable(value, reason);
        if (!liveResult) {
            fail(syntax + ".valueIsAcceptable gave bad result for " + value.toString() + "reason : " + reason);
        }
        final boolean liveResult = syntax.valueIsAcceptable(value, reason);
        assertTrue(liveResult, syntax + ".valueIsAcceptable gave bad result for " + value + "reason : " + reason);
    }