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

Jean-Noel Rouvignac
03.41.2014 3c8bcc9cc000997c780761a0c5067076ab2b0b3e
Last batch of fixes from AutoRefactor (or me) for a while.
AutoRefactor successfully goes through the whole SDK now.
7 files modified
70 ■■■■ changed files
opendj-cli/src/main/java/com/forgerock/opendj/cli/BooleanArgument.java 4 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/SizePropertyDefinition.java 6 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/SizeUnit.java 8 ●●●● patch | view | raw | blame | history
opendj-config/src/test/java/org/forgerock/opendj/config/SizeUnitTest.java 18 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/AVA.java 4 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/Base64.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java 28 ●●●●● patch | view | raw | blame | history
opendj-cli/src/main/java/com/forgerock/opendj/cli/BooleanArgument.java
@@ -66,7 +66,7 @@
    /** {@inheritDoc} */
    @Override
    final public void addValue(final String valueString) {
    public final void addValue(final String valueString) {
        if (valueString != null) {
            clearValues();
            super.addValue(valueString);
@@ -76,7 +76,7 @@
    /** {@inheritDoc} */
    @Override
    final public void setPresent(final boolean isPresent) {
    public final void setPresent(final boolean isPresent) {
        addValue(String.valueOf(isPresent));
    }
opendj-config/src/main/java/org/forgerock/opendj/config/SizePropertyDefinition.java
@@ -144,11 +144,7 @@
         *             limit is greater than the upper limit.
         */
        public final void setUpperLimit(String upperLimit) {
            if (upperLimit == null) {
                setUpperLimit((Long) null);
            } else {
                setUpperLimit(SizeUnit.parseValue(upperLimit, SizeUnit.BYTES));
            }
            setUpperLimit(upperLimit != null ? SizeUnit.parseValue(upperLimit, SizeUnit.BYTES) : null);
        }
        /**
opendj-config/src/main/java/org/forgerock/opendj/config/SizeUnit.java
@@ -39,10 +39,10 @@
    BYTES(1L, "b", "bytes"),
    /** A gibi-byte unit. */
    GIBI_BYTES(1024 * 1024 * 1024, "gib", "gibibytes"),
    GIBI_BYTES(1024L * 1024 * 1024, "gib", "gibibytes"),
    /** A giga-byte unit. */
    GIGA_BYTES(1000 * 1000 * 1000, "gb", "gigabytes"),
    GIGA_BYTES(1000L * 1000 * 1000, "gb", "gigabytes"),
    /** A kibi-byte unit. */
    KIBI_BYTES(1024L, "kib", "kibibytes"),
@@ -51,10 +51,10 @@
    KILO_BYTES(1000L, "kb", "kilobytes"),
    /** A mebi-byte unit. */
    MEBI_BYTES(1024 * 1024, "mib", "mebibytes"),
    MEBI_BYTES(1024L * 1024, "mib", "mebibytes"),
    /** A mega-byte unit. */
    MEGA_BYTES(1000 * 1000, "mb", "megabytes"),
    MEGA_BYTES(1000L * 1000, "mb", "megabytes"),
    /** A tebi-byte unit. */
    TEBI_BYTES(1024L * 1024 * 1024 * 1024, "tib", "tebibytes"),
opendj-config/src/test/java/org/forgerock/opendj/config/SizeUnitTest.java
@@ -45,7 +45,8 @@
            { "gb", SizeUnit.GIGA_BYTES },
            { "gib", SizeUnit.GIBI_BYTES },
            { "tb", SizeUnit.TERA_BYTES },
            { "tib", SizeUnit.TEBI_BYTES } };
            { "tib", SizeUnit.TEBI_BYTES },
        };
    }
    @Test(dataProvider = "stringToSizeLimitData")
@@ -80,7 +81,8 @@
            { "1000kb", 1000000L },
            { "1000 kilobytes", 1000000L },
            { "1000 KILOBYTES", 1000000L },
            { "1000 KB", 1000000L } };
            { "1000 KB", 1000000L },
        };
    }
    @Test(dataProvider = "parseValueData")
@@ -243,12 +245,12 @@
            { SizeUnit.BYTES, 1L },
            { SizeUnit.KILO_BYTES, 1000L },
            { SizeUnit.KIBI_BYTES, 1024L },
            { SizeUnit.MEGA_BYTES, (long) 1000 * 1000 },
            { SizeUnit.MEBI_BYTES, (long) 1024 * 1024 },
            { SizeUnit.GIGA_BYTES, (long) 1000 * 1000 * 1000 },
            { SizeUnit.GIBI_BYTES, (long) 1024 * 1024 * 1024 },
            { SizeUnit.TERA_BYTES, (long) 1000 * 1000 * 1000 * 1000 },
            { SizeUnit.TEBI_BYTES, (long) 1024 * 1024 * 1024 * 1024 }
            { SizeUnit.MEGA_BYTES, 1000L * 1000 },
            { SizeUnit.MEBI_BYTES, 1024L * 1024 },
            { SizeUnit.GIGA_BYTES, 1000L * 1000 * 1000 },
            { SizeUnit.GIBI_BYTES, 1024L * 1024 * 1024 },
            { SizeUnit.TERA_BYTES, 1000L * 1000 * 1000 * 1000 },
            { SizeUnit.TEBI_BYTES, 1024L * 1024 * 1024 * 1024 },
        };
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/AVA.java
@@ -184,7 +184,7 @@
            return;
        }
        if ((length % 2) != 0) {
        if (length % 2 != 0) {
            final LocalizableMessage message = ERR_HEX_DECODE_INVALID_LENGTH.get(hexBuffer);
            throw DecodeException.error(message);
        }
@@ -341,7 +341,7 @@
                // This character is escaped.
                if (isHexDigit(c)) {
                    // Unicode characters.
                    if (!(reader.remaining() > 0)) {
                    if (reader.remaining() <= 0) {
                        final LocalizableMessage msg =
                                ERR_ATTR_SYNTAX_DN_ESCAPED_HEX_VALUE_INVALID
                                        .get(reader.getString());
opendj-core/src/main/java/org/forgerock/opendj/ldap/Base64.java
@@ -69,7 +69,7 @@
        // The encoded value must have length that is a multiple of four
        // bytes.
        final int length = base64.length();
        if ((length % 4) != 0) {
        if (length % 4 != 0) {
            final LocalizableMessage message = ERR_BASE64_DECODE_INVALID_LENGTH.get(base64);
            throw new LocalizedIllegalArgumentException(message);
        }
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java
@@ -206,8 +206,10 @@
                // only digits and periods, but not consecutive periods.
                boolean lastWasPeriod = false;
                while (reader.remaining() > 0 && (c = reader.read()) != ' ' && c != ')'
                        && !(c == '\'' && enclosingQuote)) {
                while (reader.remaining() > 0
                        && (c = reader.read()) != ' '
                        && c != ')'
                        && (c != '\'' || !enclosingQuote)) {
                    if (c == '.') {
                        if (lastWasPeriod) {
                            throw DecodeException.error(
@@ -230,10 +232,11 @@
                }
            } else if (isAlpha(c)) {
                // This must be an attribute description. In this case, we will
                // only accept alphabetic characters, numeric digits, and the
                // hyphen.
                while (reader.remaining() > 0 && (c = reader.read()) != ' ' && c != ')'
                        && !(c == '\'' && enclosingQuote)) {
                // only accept alphabetic characters, numeric digits, and the hyphen.
                while (reader.remaining() > 0
                        && (c = reader.read()) != ' '
                        && c != ')'
                        && (c != '\'' || !enclosingQuote)) {
                    if (length == 0 && !isAlpha(c)) {
                        throw DecodeException.error(
                                ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1.get(c, reader.pos() - 1));
@@ -303,7 +306,9 @@
            }
            if (isDigit(c)) {
                boolean lastWasPeriod = false;
                while ((c = reader.read()) != ' ' && c != '{' && !(c == '\'' && enclosingQuote)) {
                while ((c = reader.read()) != ' '
                        && c != '{'
                        && (c != '\'' || !enclosingQuote)) {
                    if (c == '.') {
                        if (lastWasPeriod) {
                            throw DecodeException.error(
@@ -336,10 +341,11 @@
                }
            } else if (isAlpha(c)) {
                // This must be an attribute description. In this case, we will
                // only accept alphabetic characters, numeric digits, and the
                // hyphen.
                while ((c = reader.read()) != ' ' && c != ')' && c != '{'
                        && !(c == '\'' && enclosingQuote)) {
                // only accept alphabetic characters, numeric digits, and the hyphen.
                while ((c = reader.read()) != ' '
                        && c != ')'
                        && c != '{'
                        && (c != '\'' || !enclosingQuote)) {
                    if (length == 0 && !isAlpha(c)) {
                        throw DecodeException.error(
                                ERR_ATTR_SYNTAX_ILLEGAL_CHAR_IN_STRING_OID1.get(c, reader.pos() - 1));