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

Matthew Swift
29.30.2013 a1ddc35d07699c8d0635d47f9bb25e2b03965a71
Minor cleanup in preparation for final release.

* avoid using SuppressWarnings and close LDIF readers, even though they don't need closing in this case.

2 files modified
8 ■■■■ changed files
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java 4 ●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFEntryReader.java 4 ●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java
@@ -27,6 +27,7 @@
package org.forgerock.opendj.ldif;
import static com.forgerock.opendj.util.StaticUtils.closeSilently;
import static com.forgerock.opendj.util.StaticUtils.toLowerCase;
import static org.forgerock.opendj.ldap.CoreMessages.ERR_LDIF_ATTRIBUTE_NAME_MISMATCH;
import static org.forgerock.opendj.ldap.CoreMessages.ERR_LDIF_BAD_CHANGE_TYPE;
@@ -133,7 +134,6 @@
     */
    public static ChangeRecord valueOfLDIFChangeRecord(final String... ldifLines) {
        // LDIF change record reader is tolerant to missing change types.
        @SuppressWarnings("resource")
        final LDIFChangeRecordReader reader = new LDIFChangeRecordReader(ldifLines);
        try {
            if (!reader.hasNext()) {
@@ -161,6 +161,8 @@
            final LocalizableMessage message =
                    WARN_READ_LDIF_RECORD_UNEXPECTED_IO_ERROR.get(e.getMessage());
            throw new LocalizedIllegalArgumentException(message);
        } finally {
            closeSilently(reader);
        }
    }
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldif/LDIFEntryReader.java
@@ -27,6 +27,7 @@
package org.forgerock.opendj.ldif;
import static com.forgerock.opendj.util.StaticUtils.closeSilently;
import static org.forgerock.opendj.ldap.CoreMessages.ERR_LDIF_ENTRY_EXCLUDED_BY_DN;
import static org.forgerock.opendj.ldap.CoreMessages.ERR_LDIF_ENTRY_EXCLUDED_BY_FILTER;
import static org.forgerock.opendj.ldap.CoreMessages.WARN_READ_LDIF_RECORD_MULTIPLE_CHANGE_RECORDS_FOUND;
@@ -79,7 +80,6 @@
     *             If {@code ldifLines} was {@code null}.
     */
    public static Entry valueOfLDIFEntry(final String... ldifLines) {
        @SuppressWarnings("resource")
        final LDIFEntryReader reader = new LDIFEntryReader(ldifLines);
        try {
            if (!reader.hasNext()) {
@@ -107,6 +107,8 @@
            final LocalizableMessage message =
                    WARN_READ_LDIF_RECORD_UNEXPECTED_IO_ERROR.get(e.getMessage());
            throw new LocalizedIllegalArgumentException(message);
        } finally {
            closeSilently(reader);
        }
    }