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

Jean-Noel Rouvignac
29.13.2015 609288638ae3e80ac92b36bba51551cb62830c2f
AutoRefactor'ed code cleanups
7 files modified
65 ■■■■■ changed files
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1ByteSequenceReader.java 13 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1InputStreamReader.java 21 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java 5 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/DNTestCase.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ASN1BufferReader.java 15 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AddRate.java 5 ●●●●● patch | view | raw | blame | history
opendj-sdk/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1ByteSequenceReader.java
@@ -75,19 +75,14 @@
    /** {@inheritDoc} */
    public boolean elementAvailable() throws IOException {
        if ((state == ASN1.ELEMENT_READ_STATE_NEED_TYPE) && !needTypeState(false)) {
            return false;
        }
        if ((state == ASN1.ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE)
                && !needFirstLengthByteState(false)) {
            return false;
        }
        return peekLength <= reader.remaining();
        return (state != ASN1.ELEMENT_READ_STATE_NEED_TYPE || needTypeState(false))
            && (state != ASN1.ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE || needFirstLengthByteState(false))
            && peekLength <= reader.remaining();
    }
    /** {@inheritDoc} */
    public boolean hasNextElement() throws IOException {
        return (state != ASN1.ELEMENT_READ_STATE_NEED_TYPE) || needTypeState(false);
        return state != ASN1.ELEMENT_READ_STATE_NEED_TYPE || needTypeState(false);
    }
    /** {@inheritDoc} */
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1InputStreamReader.java
@@ -84,18 +84,11 @@
    /** {@inheritDoc} */
    public boolean elementAvailable() throws IOException {
        if ((state == ASN1.ELEMENT_READ_STATE_NEED_TYPE) && !needTypeState(false, false)) {
            return false;
        }
        if ((state == ASN1.ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE)
                && !needFirstLengthByteState(false, false)) {
            return false;
        }
        if ((state == ASN1.ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES)
                && !needAdditionalLengthBytesState(false, false)) {
            return false;
        }
        return peekLength <= in.available();
        return (state != ASN1.ELEMENT_READ_STATE_NEED_TYPE || needTypeState(false, false))
            && (state != ASN1.ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE || needFirstLengthByteState(false, false))
            && (state != ASN1.ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES
                 || needAdditionalLengthBytesState(false, false))
            && peekLength <= in.available();
    }
    /** {@inheritDoc} */
@@ -105,10 +98,10 @@
            // haven't exhausted the size limit for the sub sequence sub input
            // stream.
            final SizeLimitInputStream subSq = (SizeLimitInputStream) in;
            return (subSq.getSizeLimit() - subSq.getBytesRead() > 0);
            return subSq.getSizeLimit() - subSq.getBytesRead() > 0;
        }
        return (state != ASN1.ELEMENT_READ_STATE_NEED_TYPE) || needTypeState(true, false);
        return state != ASN1.ELEMENT_READ_STATE_NEED_TYPE || needTypeState(true, false);
    }
    /** {@inheritDoc} */
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java
@@ -475,12 +475,11 @@
        boolean schemaValidationFailure = false;
        final List<LocalizableMessage> schemaErrors = new LinkedList<LocalizableMessage>();
        if (lastLDIFLine != null) {
        if (lastLDIFLine != null
            // This line was read when looking for the change type.
            if (!readLDIFRecordAttributeValue(record, lastLDIFLine, entry, schemaErrors)) {
                && !readLDIFRecordAttributeValue(record, lastLDIFLine, entry, schemaErrors)) {
                schemaValidationFailure = true;
            }
        }
        while (record.iterator.hasNext()) {
            final String ldifLine = record.iterator.next();
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/DNTestCase.java
@@ -1087,8 +1087,8 @@
        assertThat(Integer.signum(cmp)).isEqualTo(expectedCompareResult);
    }
    /** Additional tests with testDNs data provider. */
    @Test(dataProvider = "testDNs")
    /** Additional tests with testDNs data provider */
    public void testToIrreversibleNormalizedByteString2(String one, String two, String three) {
        DN dn1 = DN.valueOf(one);
        DN dn2 = DN.valueOf(two);
@@ -1139,8 +1139,8 @@
        assertEquals(actual.toIrreversibleReadableString(), expectedReadableString);
    }
    /** Additional tests with testDNs data provider. */
    @Test(dataProvider = "testDNs")
    /** Additional tests with testDNs data provider */
    public void testToIrreversibleReadableString2(String one, String two, String three) {
        DN dn1 = DN.valueOf(one);
        DN dn2 = DN.valueOf(two);
opendj-sdk/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ASN1BufferReader.java
@@ -54,7 +54,7 @@
        private int bytesRead;
        public void checkLimit(final int readSize) throws IOException {
            if ((readLimit > 0) && (bytesRead + readSize > readLimit)) {
            if (0 < readLimit && readLimit < bytesRead + readSize) {
                final LocalizableMessage message = ERR_ASN1_TRUNCATED_LENGTH_BYTE.get();
                throw DecodeException.fatalError(message);
            }
@@ -178,14 +178,11 @@
     *             If an error occurs while trying to decode an ASN1 element.
     */
    public boolean elementAvailable() throws IOException {
        return !((state == ASN1.ELEMENT_READ_STATE_NEED_TYPE)
                        && !needTypeState(true))
                && !((state == ASN1.ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE)
                        && !needFirstLengthByteState(true))
                && !((state == ASN1.ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES)
                        && !needAdditionalLengthBytesState(true))
        return (state != ASN1.ELEMENT_READ_STATE_NEED_TYPE || needTypeState(true))
                && (state != ASN1.ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE || needFirstLengthByteState(true))
                && (state != ASN1.ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES
                    || needAdditionalLengthBytesState(true))
                && peekLength <= readLimiter.remaining();
    }
    /**
@@ -198,7 +195,7 @@
     *             If an error occurs while trying to decode an ASN1 element.
     */
    public boolean hasNextElement() throws IOException {
        return (state != ASN1.ELEMENT_READ_STATE_NEED_TYPE) || needTypeState(true);
        return state != ASN1.ELEMENT_READ_STATE_NEED_TYPE || needTypeState(true);
    }
    /** {@inheritDoc} */
opendj-sdk/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AddRate.java
@@ -193,12 +193,11 @@
            private void startPurgeIfMaxNumberAddReached() {
                AtomicBoolean purgeLatch = new AtomicBoolean();
                if (!isPurgeBranchRunning.get()
                            && 0 < maxNbAddIterations && maxNbAddIterations < totalAdds.get()) {
                    if (purgeLatch.compareAndSet(false, true)) {
                            && 0 < maxNbAddIterations && maxNbAddIterations < totalAdds.get()
                            && purgeLatch.compareAndSet(false, true)) {
                        newPurgerThread().start();
                    }
                }
            }
            // FIXME Followings @Checkstyle:ignore tags are related to the maven-checkstyle-plugin
            // issue related here: https://github.com/checkstyle/checkstyle/issues/5
opendj-sdk/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java
@@ -226,7 +226,7 @@
        }
    }
    //To allow tests
    /** To allow tests. */
    static ResponseTimeBuckets getResponseTimeBuckets() {
        return new ResponseTimeBuckets();
    }