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

Jean-Noël Rouvignac
31.51.2015 812633492377cd0d172505ee2717d2a3f8dd34c1
Fix Eclipse warnings
9 files modified
86 ■■■■■ changed files
opendj-sdk/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/UpdateCopyrightMojo.java 9 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedRequest.java 13 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/CommonLDAPOptions.java 10 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java 10 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java 11 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromiseWrapper.java 10 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java 10 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java 8 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactoryTestCase.java 5 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/UpdateCopyrightMojo.java
@@ -20,7 +20,7 @@
 *
 * CDDL HEADER END
 *
 *      Copyright 2015 ForgeRock AS
 *      Copyright 2016 ForgeRock AS
 */
package org.forgerock.maven;
@@ -308,11 +308,10 @@
                linePattern = bufferedLines.get(indexCommentToken++);
                commentToken = getCommentTokenInBlock(linePattern);
            }
            if (commentToken != null) {
                return linePattern.substring(0, linePattern.indexOf(commentToken) + 1);
            } else {
                throw new Exception("Uncompatibles comments lines in the file.");
            if (commentToken == null) {
                throw new Exception("Incompatibles comments lines in the file.");
            }
            return linePattern.substring(0, linePattern.indexOf(commentToken) + 1);
        }
    }
opendj-sdk/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedRequest.java
@@ -22,9 +22,8 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS
 *      Portions copyright 2013-2016 ForgeRock AS
 */
package com.forgerock.opendj.ldap.extensions;
import java.io.IOException;
@@ -87,12 +86,13 @@
                final DecodeOptions options) throws DecodeException {
            if (result instanceof GetConnectionIDExtendedResult) {
                return (GetConnectionIDExtendedResult) result;
            } else {
            }
                final ResultCode resultCode = result.getResultCode();
                final GetConnectionIDExtendedResult newResult =
                        GetConnectionIDExtendedResult.newResult(resultCode).setMatchedDN(
                                result.getMatchedDN()).setDiagnosticMessage(
                                result.getDiagnosticMessage());
                    GetConnectionIDExtendedResult.newResult(resultCode)
                        .setMatchedDN(result.getMatchedDN())
                        .setDiagnosticMessage(result.getDiagnosticMessage());
                final ByteString responseValue = result.getValue();
                if (!resultCode.isExceptional() && responseValue == null) {
@@ -113,7 +113,6 @@
                return newResult;
            }
        }
    }
    /**
     * The OID for the extended operation that can be used to get the client
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/CommonLDAPOptions.java
@@ -20,9 +20,8 @@
 *
 * CDDL HEADER END
 *
 *      Copyright 2014-2015 ForgeRock AS.
 *      Copyright 2014-2016 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
import static com.forgerock.opendj.util.StaticUtils.getProvider;
@@ -94,12 +93,6 @@
     * <p>
     * The default setting is {@code -1} (disabled) and may be configured using
     * the {@code org.forgerock.opendj.io.linger} property.
     *
     * @param linger
     *            The value of the {@link java.net.SocketOptions#SO_LINGER
     *            SO_LINGER} socket option for new connections, or -1 if linger
     *            should be disabled.
     * @return A reference to this set of options.
     */
    public static final Option<Integer> SO_LINGER_IN_SECONDS = Option.withDefault(
        getIntProperty("org.forgerock.opendj.io.linger", -1));
@@ -110,7 +103,6 @@
     * <p>
     * The default setting is {@code true} and may be configured using the
     * {@code org.forgerock.opendj.io.keepAlive} property.
     *
     */
    public static final Option<Boolean> SO_KEEPALIVE = Option.withDefault(
        getBooleanProperty("org.forgerock.opendj.io.keepAlive", true));
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2014 ForgeRock AS.
 *      Portions copyright 2012-2016 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.requests;
@@ -72,7 +72,10 @@
        final List<Control> controls = impl.getControls();
        final Control control = AbstractRequestImpl.getControl(controls, decoder.getOID());
        if (control != null) {
        if (control == null) {
            return null;
        }
            // Got a match. Return a defensive copy only if necessary.
            final C decodedControl = decoder.decodeControl(control, options);
            if (decodedControl != control) {
@@ -87,9 +90,6 @@
                final GenericControl genericControl = GenericControl.newControl(control);
                return decoder.decodeControl(genericControl, options);
            }
        } else {
            return null;
        }
    }
    @Override
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2015 ForgeRock AS
 *      Portions Copyright 2011-2016 ForgeRock AS
 *      Portions Copyright 2014 Manuel Gaupp
 */
package org.forgerock.opendj.ldap.schema;
@@ -516,9 +516,8 @@
            final AttributeType type = getAttributeType0(name);
            if (type != null) {
                return type;
            } else {
                throw new UnknownSchemaElementException(WARN_ATTR_TYPE_UNKNOWN.get(name));
            }
            throw new UnknownSchemaElementException(WARN_ATTR_TYPE_UNKNOWN.get(name));
        }
        @Override
@@ -1835,7 +1834,7 @@
                // should be valid.
                foundMatchingNameForms = true;
                if (checkNameForm(entry, policy, nameFormWarnings, nf)) {
                if (checkNameForm(entry, nameFormWarnings, nf)) {
                    nameForm = nf;
                    break;
                }
@@ -2117,8 +2116,8 @@
        return true;
    }
    private boolean checkNameForm(final Entry entry, final SchemaValidationPolicy policy,
            final List<LocalizableMessage> nameFormWarnings, final NameForm nameForm) {
    private boolean checkNameForm(final Entry entry, final List<LocalizableMessage> nameFormWarnings,
            final NameForm nameForm) {
        final RDN rdn = entry.getName().rdn();
        if (rdn != null) {
            // Make sure that all the required AVAs are present.
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromiseWrapper.java
@@ -21,11 +21,12 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2014-2015 ForgeRock AS.
 *      Copyright 2014-2016 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.spi;
import static org.forgerock.opendj.ldap.spi.LdapPromises.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@@ -33,14 +34,12 @@
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LdapPromise;
import org.forgerock.util.AsyncFunction;
import org.forgerock.util.promise.ExceptionHandler;
import org.forgerock.util.Function;
import org.forgerock.util.promise.ExceptionHandler;
import org.forgerock.util.promise.Promise;
import org.forgerock.util.promise.ResultHandler;
import org.forgerock.util.promise.RuntimeExceptionHandler;
import static org.forgerock.opendj.ldap.spi.LdapPromises.*;
/**
 * Provides a {@link Promise} wrapper and a {@link LdapPromise} implementation.
 *
@@ -63,7 +62,6 @@
        this.requestID = requestID;
    }
    @SuppressWarnings("unchecked")
    @Override
    public int getRequestID() {
        return wrappedPromise instanceof LdapPromise ? ((LdapPromise<R>) wrappedPromise).getRequestID()
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2015 ForgeRock AS
 *      Portions copyright 2011-2016 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -304,16 +304,16 @@
                    b(0xFF), b(0xFF), b(0xFF), b(0xFF), b(0xFF) } },
            { new ByteStringBuilder(11).appendUtf8("this is a").appendUtf8(" test"),
                "this is a test".getBytes("UTF-8") },
            { new ByteStringBuilder().appendObject((Object) "this is a").appendObject((Object) " test"),
            { new ByteStringBuilder().appendObject("this is a").appendObject(" test"),
                "this is a test".getBytes("UTF-8") },
            {
                new ByteStringBuilder().appendUtf8("this is a".toCharArray()).appendUtf8(
                        " test".toCharArray()), "this is a test".getBytes("UTF-8") },
            {
                new ByteStringBuilder().appendObject((Object) "this is a".toCharArray()).appendObject(
                        (Object) " test".toCharArray()), "this is a test".getBytes("UTF-8") },
                new ByteStringBuilder().appendObject("this is a".toCharArray()).appendObject(
                        " test".toCharArray()), "this is a test".getBytes("UTF-8") },
            {
                new ByteStringBuilder().appendObject((Object) EIGHT_BYTES).appendObject((Object) EIGHT_BYTES),
                new ByteStringBuilder().appendObject(EIGHT_BYTES).appendObject(EIGHT_BYTES),
                new byte[] { b(0x01), b(0x02), b(0x03), b(0x04), b(0x05),
                    b(0x06), b(0x07), b(0x08), b(0x01), b(0x02), b(0x03),
                    b(0x04), b(0x05), b(0x06), b(0x07), b(0x08) } },
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2015 ForgeRock AS
 *      Portions copyright 2011-2016 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -77,13 +77,13 @@
                new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
                    (byte) 0x00, (byte) 0x00, (byte) 0x00 } },
            { ByteString.valueOfUtf8("cn=testvalue"), "cn=testvalue".getBytes("UTF-8") },
            { ByteString.valueOfObject((Object) "cn=testvalue"), "cn=testvalue".getBytes("UTF-8") },
            { ByteString.valueOfObject("cn=testvalue"), "cn=testvalue".getBytes("UTF-8") },
            { ByteString.valueOfUtf8("cn=testvalue".toCharArray()), "cn=testvalue".getBytes("UTF-8") },
            { ByteString.valueOfObject((Object) "cn=testvalue".toCharArray()),
            { ByteString.valueOfObject("cn=testvalue".toCharArray()),
                "cn=testvalue".getBytes("UTF-8") },
            { ByteString.valueOfBytes(new byte[0]), new byte[0] },
            { ByteString.valueOfBytes(testBytes), testBytes },
            { ByteString.valueOfObject((Object) testBytes), testBytes },
            { ByteString.valueOfObject(testBytes), testBytes },
            { ByteString.valueOfObject(ByteString.valueOfUtf8("cn=testvalue")),
                "cn=testvalue".getBytes("UTF-8") },
            { ByteString.wrap(new byte[0]), new byte[0] },
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactoryTestCase.java
@@ -21,9 +21,8 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2013-2015 ForgeRock AS.
 *      Copyright 2013-2016 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
import static org.fest.assertions.Assertions.assertThat;
@@ -307,7 +306,6 @@
        assertThat(hbc.isClosed()).isFalse();
    }
    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Test(description = "OPENDJ-1348")
    public void testBindPreventsHeartBeatTimeout() throws Exception {
        mockConnectionWithInitialHeartbeatResult(ResultCode.SUCCESS);
@@ -366,7 +364,6 @@
        assertThat(hbc.isValid()).isFalse();
    }
    @SuppressWarnings({ "unchecked", "rawtypes" })
    @Test
    public void testHeartBeatWhileBindInProgress() throws Exception {
        mockConnectionWithInitialHeartbeatResult(ResultCode.SUCCESS);