You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2020/09/01 14:05:00 UTC
[commons-codec] 01/05: Fix checkstyle
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git
commit d470c55714a656f3562b71c391cc67afa0e02ef0
Author: aherbert <ah...@apache.org>
AuthorDate: Tue Sep 1 14:52:57 2020 +0100
Fix checkstyle
---
src/main/java/org/apache/commons/codec/binary/Base16.java | 6 ++++--
src/main/java/org/apache/commons/codec/binary/Base32.java | 11 +++++++----
.../org/apache/commons/codec/binary/Base32InputStream.java | 4 ++--
.../org/apache/commons/codec/binary/Base32OutputStream.java | 4 ++--
src/main/java/org/apache/commons/codec/binary/Base64.java | 9 ++++++---
.../org/apache/commons/codec/binary/Base64InputStream.java | 4 ++--
.../org/apache/commons/codec/binary/Base64OutputStream.java | 4 ++--
src/main/java/org/apache/commons/codec/binary/BaseNCodec.java | 9 +++++----
.../org/apache/commons/codec/binary/CharSequenceUtils.java | 2 +-
src/main/java/org/apache/commons/codec/binary/Hex.java | 2 +-
.../java/org/apache/commons/codec/binary/StringUtils.java | 8 ++++----
.../apache/commons/codec/digest/MessageDigestAlgorithms.java | 3 ++-
.../apache/commons/codec/binary/CharSequenceUtilsTest.java | 6 +++---
13 files changed, 41 insertions(+), 31 deletions(-)
diff --git a/src/main/java/org/apache/commons/codec/binary/Base16.java b/src/main/java/org/apache/commons/codec/binary/Base16.java
index 9ab5fc2..df6f252 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base16.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base16.java
@@ -162,7 +162,8 @@ public class Base16 extends BaseNCodec {
// small optimisation to short-cut the rest of this method when it is fed byte-by-byte
if (availableChars == 1 && availableChars == dataLen) {
- context.ibitWorkArea = decodeOctet(data[offset]) + 1; // store 1/2 byte for next invocation of decode, we offset by +1 as empty-value is 0
+ // store 1/2 byte for next invocation of decode, we offset by +1 as empty-value is 0
+ context.ibitWorkArea = decodeOctet(data[offset]) + 1;
return;
}
@@ -194,7 +195,8 @@ public class Base16 extends BaseNCodec {
// we have one char of a hex-pair left over
if (i < dataLen) {
- context.ibitWorkArea = decodeOctet(data[i]) + 1; // store 1/2 byte for next invocation of decode, we offset by +1 as empty-value is 0
+ // store 1/2 byte for next invocation of decode, we offset by +1 as empty-value is 0
+ context.ibitWorkArea = decodeOctet(data[i]) + 1;
}
}
diff --git a/src/main/java/org/apache/commons/codec/binary/Base32.java b/src/main/java/org/apache/commons/codec/binary/Base32.java
index 0194579..483d82d 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base32.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base32.java
@@ -94,7 +94,7 @@ public class Base32 extends BaseNCodec {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, // 30-3f 0-9
-1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 40-4f A-O
25, 26, 27, 28, 29, 30, 31, // 50-56 P-V
- -1, -1, -1, -1, -1, -1, -1, -1, -1, // 57-5f
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, // 57-5f
-1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 60-6f a-o
25, 26, 27, 28, 29, 30, 31 // 70-76 p-v
};
@@ -313,7 +313,8 @@ public class Base32 extends BaseNCodec {
* lineLength > 0 and lineSeparator is null.
* @since 1.15
*/
- public Base32(final int lineLength, final byte[] lineSeparator, final boolean useHex, final byte padding, CodecPolicy decodingPolicy) {
+ public Base32(final int lineLength, final byte[] lineSeparator, final boolean useHex,
+ final byte padding, CodecPolicy decodingPolicy) {
super(BYTES_PER_UNENCODED_BLOCK, BYTES_PER_ENCODED_BLOCK, lineLength,
lineSeparator == null ? 0 : lineSeparator.length, padding, decodingPolicy);
if (useHex) {
@@ -603,7 +604,8 @@ public class Base32 extends BaseNCodec {
// Use the long bit work area
if (isStrictDecoding() && (context.lbitWorkArea & emptyBitsMask) != 0) {
throw new IllegalArgumentException(
- "Strict decoding: Last encoded character (before the paddings if any) is a valid base 32 alphabet but not a possible encoding. " +
+ "Strict decoding: Last encoded character (before the paddings if any) is a valid " +
+ "base 32 alphabet but not a possible encoding. " +
"Expected the discarded bits from the character to be zero.");
}
}
@@ -617,7 +619,8 @@ public class Base32 extends BaseNCodec {
private void validateTrailingCharacters() {
if (isStrictDecoding()) {
throw new IllegalArgumentException(
- "Strict decoding: Last encoded character(s) (before the paddings if any) are valid base 32 alphabet but not a possible encoding. " +
+ "Strict decoding: Last encoded character(s) (before the paddings if any) are valid " +
+ "base 32 alphabet but not a possible encoding. " +
"Decoding requires either 2, 4, 5, or 7 trailing 5-bit characters to create bytes.");
}
}
diff --git a/src/main/java/org/apache/commons/codec/binary/Base32InputStream.java b/src/main/java/org/apache/commons/codec/binary/Base32InputStream.java
index 92a6a74..eeb8544 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base32InputStream.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base32InputStream.java
@@ -34,8 +34,8 @@ import org.apache.commons.codec.CodecPolicy;
* character encodings which are compatible with the lower 127 ASCII chart (ISO-8859-1, Windows-1252, UTF-8, etc).
* </p>
* <p>
- * You can set the decoding behavior when the input bytes contain leftover trailing bits that cannot be created by a valid
- * encoding. These can be bits that are unused from the final character or entire characters. The default mode is
+ * You can set the decoding behavior when the input bytes contain leftover trailing bits that cannot be created by a
+ * valid encoding. These can be bits that are unused from the final character or entire characters. The default mode is
* lenient decoding.
* </p>
* <ul>
diff --git a/src/main/java/org/apache/commons/codec/binary/Base32OutputStream.java b/src/main/java/org/apache/commons/codec/binary/Base32OutputStream.java
index a553a7d..6456d47 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base32OutputStream.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base32OutputStream.java
@@ -38,8 +38,8 @@ import org.apache.commons.codec.CodecPolicy;
* final padding will be omitted and the resulting data will be incomplete/inconsistent.
* </p>
* <p>
- * You can set the decoding behavior when the input bytes contain leftover trailing bits that cannot be created by a valid
- * encoding. These can be bits that are unused from the final character or entire characters. The default mode is
+ * You can set the decoding behavior when the input bytes contain leftover trailing bits that cannot be created by a
+ * valid encoding. These can be bits that are unused from the final character or entire characters. The default mode is
* lenient decoding.
* </p>
* <ul>
diff --git a/src/main/java/org/apache/commons/codec/binary/Base64.java b/src/main/java/org/apache/commons/codec/binary/Base64.java
index 76a14d2..751b84e 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base64.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base64.java
@@ -580,7 +580,8 @@ public class Base64 extends BaseNCodec {
* Thrown when the {@code lineSeparator} contains Base64 characters.
* @since 1.15
*/
- public Base64(final int lineLength, final byte[] lineSeparator, final boolean urlSafe, final CodecPolicy decodingPolicy) {
+ public Base64(final int lineLength, final byte[] lineSeparator, final boolean urlSafe,
+ final CodecPolicy decodingPolicy) {
super(BYTES_PER_UNENCODED_BLOCK, BYTES_PER_ENCODED_BLOCK,
lineLength,
lineSeparator == null ? 0 : lineSeparator.length,
@@ -826,7 +827,8 @@ public class Base64 extends BaseNCodec {
private void validateCharacter(final int emptyBitsMask, final Context context) {
if (isStrictDecoding() && (context.ibitWorkArea & emptyBitsMask) != 0) {
throw new IllegalArgumentException(
- "Strict decoding: Last encoded character (before the paddings if any) is a valid base 64 alphabet but not a possible encoding. " +
+ "Strict decoding: Last encoded character (before the paddings if any) is a valid " +
+ "base 64 alphabet but not a possible encoding. " +
"Expected the discarded bits from the character to be zero.");
}
}
@@ -840,7 +842,8 @@ public class Base64 extends BaseNCodec {
private void validateTrailingCharacter() {
if (isStrictDecoding()) {
throw new IllegalArgumentException(
- "Strict decoding: Last encoded character (before the paddings if any) is a valid base 64 alphabet but not a possible encoding. " +
+ "Strict decoding: Last encoded character (before the paddings if any) is a valid " +
+ "base 64 alphabet but not a possible encoding. " +
"Decoding requires at least two trailing 6-bit characters to create bytes.");
}
}
diff --git a/src/main/java/org/apache/commons/codec/binary/Base64InputStream.java b/src/main/java/org/apache/commons/codec/binary/Base64InputStream.java
index 7755ce1..661d68d 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base64InputStream.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base64InputStream.java
@@ -38,8 +38,8 @@ import org.apache.commons.codec.CodecPolicy;
* character encodings which are compatible with the lower 127 ASCII chart (ISO-8859-1, Windows-1252, UTF-8, etc).
* </p>
* <p>
- * You can set the decoding behavior when the input bytes contain leftover trailing bits that cannot be created by a valid
- * encoding. These can be bits that are unused from the final character or entire characters. The default mode is
+ * You can set the decoding behavior when the input bytes contain leftover trailing bits that cannot be created by a
+ * valid encoding. These can be bits that are unused from the final character or entire characters. The default mode is
* lenient decoding.
* </p>
* <ul>
diff --git a/src/main/java/org/apache/commons/codec/binary/Base64OutputStream.java b/src/main/java/org/apache/commons/codec/binary/Base64OutputStream.java
index aa9be55..750411b 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base64OutputStream.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base64OutputStream.java
@@ -42,8 +42,8 @@ import org.apache.commons.codec.CodecPolicy;
* final padding will be omitted and the resulting data will be incomplete/inconsistent.
* </p>
* <p>
- * You can set the decoding behavior when the input bytes contain leftover trailing bits that cannot be created by a valid
- * encoding. These can be bits that are unused from the final character or entire characters. The default mode is
+ * You can set the decoding behavior when the input bytes contain leftover trailing bits that cannot be created by a
+ * valid encoding. These can be bits that are unused from the final character or entire characters. The default mode is
* lenient decoding.
* </p>
* <ul>
diff --git a/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java b/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
index 5819405..256d1f1 100644
--- a/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
+++ b/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
@@ -33,8 +33,8 @@ import org.apache.commons.codec.EncoderException;
* This class is thread-safe.
* </p>
*
- * You can set the decoding behavior when the input bytes contain leftover trailing bits that cannot be created by a valid
- * encoding. These can be bits that are unused from the final character or entire characters. The default mode is
+ * You can set the decoding behavior when the input bytes contain leftover trailing bits that cannot be created by a
+ * valid encoding. These can be bits that are unused from the final character or entire characters. The default mode is
* lenient decoding.
* <ul>
* <li>Lenient: Any trailing bits are composed into 8-bit bytes where possible. The remainder are discarded.
@@ -376,7 +376,8 @@ public abstract class BaseNCodec implements BinaryEncoder, BinaryDecoder {
* @since 1.15
*/
protected BaseNCodec(final int unencodedBlockSize, final int encodedBlockSize,
- final int lineLength, final int chunkSeparatorLength, final byte pad, final CodecPolicy decodingPolicy) {
+ final int lineLength, final int chunkSeparatorLength, final byte pad,
+ final CodecPolicy decodingPolicy) {
this.unencodedBlockSize = unencodedBlockSize;
this.encodedBlockSize = encodedBlockSize;
final boolean useChunking = lineLength > 0 && chunkSeparatorLength > 0;
@@ -582,7 +583,7 @@ public abstract class BaseNCodec implements BinaryEncoder, BinaryDecoder {
/**
* Returns the decoding behavior policy.
- *
+ *
* <p>
* The default is lenient. If the decoding policy is strict, then decoding will raise an
* {@link IllegalArgumentException} if trailing bits are not part of a valid encoding. Decoding will compose
diff --git a/src/main/java/org/apache/commons/codec/binary/CharSequenceUtils.java b/src/main/java/org/apache/commons/codec/binary/CharSequenceUtils.java
index 7cc9acd..4e565a9 100644
--- a/src/main/java/org/apache/commons/codec/binary/CharSequenceUtils.java
+++ b/src/main/java/org/apache/commons/codec/binary/CharSequenceUtils.java
@@ -31,7 +31,7 @@ public class CharSequenceUtils {
/**
* Green implementation of regionMatches.
- *
+ *
* <p>Note: This function differs from the current implementation in Apache Commons Lang
* where the input indices are not valid. It is only used within this package.
*
diff --git a/src/main/java/org/apache/commons/codec/binary/Hex.java b/src/main/java/org/apache/commons/codec/binary/Hex.java
index bc939ad..2294956 100644
--- a/src/main/java/org/apache/commons/codec/binary/Hex.java
+++ b/src/main/java/org/apache/commons/codec/binary/Hex.java
@@ -123,7 +123,7 @@ public class Hex implements BinaryEncoder, BinaryDecoder {
* @return A byte array containing binary data decoded from the supplied char array.
* @throws DecoderException Thrown if an odd number of characters or illegal characters are supplied
* @since 1.11
- */
+ */
public static byte[] decodeHex(final String data) throws DecoderException {
return decodeHex(data.toCharArray());
}
diff --git a/src/main/java/org/apache/commons/codec/binary/StringUtils.java b/src/main/java/org/apache/commons/codec/binary/StringUtils.java
index 176c3d6..fe4e69f 100644
--- a/src/main/java/org/apache/commons/codec/binary/StringUtils.java
+++ b/src/main/java/org/apache/commons/codec/binary/StringUtils.java
@@ -138,8 +138,8 @@ public class StringUtils {
* the String to encode, may be {@code null}
* @return encoded bytes, or {@code null} if the input string was {@code null}
* @throws NullPointerException
- * Thrown if {@link StandardCharsets#ISO_8859_1} is not initialized, which should never happen since it is
- * required by the Java platform specification.
+ * Thrown if {@link StandardCharsets#ISO_8859_1} is not initialized, which should never happen
+ * since it is required by the Java platform specification.
* @since As of 1.7, throws {@link NullPointerException} instead of UnsupportedEncodingException
* @see <a href="http://download.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
* @see #getBytesUnchecked(String, String)
@@ -328,8 +328,8 @@ public class StringUtils {
* @return A new {@code String} decoded from the specified array of bytes using the ISO-8859-1 charset, or
* {@code null} if the input byte array was {@code null}.
* @throws NullPointerException
- * Thrown if {@link StandardCharsets#ISO_8859_1} is not initialized, which should never happen since it is
- * required by the Java platform specification.
+ * Thrown if {@link StandardCharsets#ISO_8859_1} is not initialized, which should never happen
+ * since it is required by the Java platform specification.
* @since As of 1.7, throws {@link NullPointerException} instead of UnsupportedEncodingException
*/
public static String newStringIso8859_1(final byte[] bytes) {
diff --git a/src/main/java/org/apache/commons/codec/digest/MessageDigestAlgorithms.java b/src/main/java/org/apache/commons/codec/digest/MessageDigestAlgorithms.java
index ff62f7e..143b281 100644
--- a/src/main/java/org/apache/commons/codec/digest/MessageDigestAlgorithms.java
+++ b/src/main/java/org/apache/commons/codec/digest/MessageDigestAlgorithms.java
@@ -162,7 +162,8 @@ public class MessageDigestAlgorithms {
public static String[] values() {
// N.B. do not use a constant array here as that can be changed externally by accident or design
return new String[] {
- MD2, MD5, SHA_1, SHA_224, SHA_256, SHA_384, SHA_512, SHA_512_224, SHA_512_256, SHA3_224, SHA3_256, SHA3_384, SHA3_512
+ MD2, MD5, SHA_1, SHA_224, SHA_256, SHA_384,
+ SHA_512, SHA_512_224, SHA_512_256, SHA3_224, SHA3_256, SHA3_384, SHA3_512
};
}
diff --git a/src/test/java/org/apache/commons/codec/binary/CharSequenceUtilsTest.java b/src/test/java/org/apache/commons/codec/binary/CharSequenceUtilsTest.java
index ada5865..e903184 100644
--- a/src/test/java/org/apache/commons/codec/binary/CharSequenceUtilsTest.java
+++ b/src/test/java/org/apache/commons/codec/binary/CharSequenceUtilsTest.java
@@ -27,8 +27,8 @@ import org.junit.Test;
* Tests {@link org.apache.commons.codec.binary.CharSequenceUtils}.
*
* <p>Tests copied from Apache Commons Lang 3.11. The implementation in codec is based on
- * an earlier version of Lang and some tests fail. The CharSequenceUtils class is public but
- * the method is package private. The failing tests have been commented out and the
+ * an earlier version of Lang and some tests fail. The CharSequenceUtils class is public but
+ * the method is package private. The failing tests have been commented out and the
* implementation left unchanged.
*/
public class CharSequenceUtilsTest {
@@ -111,7 +111,7 @@ public class CharSequenceUtilsTest {
invoke();
Assert.fail(msg + " but nothing was thrown.");
} catch (Exception ex) {
- assertTrue(msg + " but was " + ex.getClass().getSimpleName(),
+ assertTrue(msg + " but was " + ex.getClass().getSimpleName(),
data.throwable.isAssignableFrom(ex.getClass()));
}
} else {