Skip to content

Commit 32d9f41

Browse files
committed
Add Checkstyle WhitespaceAround
1 parent 3986ba6 commit 32d9f41

File tree

12 files changed

+29
-16
lines changed

12 files changed

+29
-16
lines changed

src/conf/checkstyle.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,6 @@ limitations under the License.
7878
<module name="UnnecessaryParentheses" />
7979
<module name="UnusedImports" />
8080
<module name="WhitespaceAfter" />
81+
<module name="WhitespaceAround" />
8182
</module>
8283
</module>

src/main/java/org/apache/commons/io/FilenameUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ private static String doNormalize(final String fileName, final char separator, f
413413
lastIsDirectory = true;
414414
}
415415
System.arraycopy(array, i + 1, array, i - 1, size - i);
416-
size -=2;
416+
size -= 2;
417417
i--;
418418
}
419419
}
@@ -1547,7 +1547,7 @@ static String[] splitOnTokens(final String text) {
15471547
}
15481548
if (ch == '?') {
15491549
list.add("?");
1550-
} else if (prevChar != '*') {// ch == '*' here; check if previous char was '*'
1550+
} else if (prevChar != '*') { // ch == '*' here; check if previous char was '*'
15511551
list.add("*");
15521552
}
15531553
} else {

src/main/java/org/apache/commons/io/function/Constants.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ final class Constants {
2626
* No-op singleton.
2727
*/
2828
@SuppressWarnings("rawtypes")
29-
static final IOBiConsumer IO_BI_CONSUMER = (t, u) -> {/* No-op */};
29+
static final IOBiConsumer IO_BI_CONSUMER = (t, u) -> {
30+
// noop
31+
};
3032

3133
/**
3234
* No-op singleton.
3335
*/
34-
static final IORunnable IO_RUNNABLE = () -> {/* No-op */};
36+
static final IORunnable IO_RUNNABLE = () -> {
37+
// noop
38+
};
3539

3640
/**
3741
* No-op singleton.
@@ -59,7 +63,9 @@ final class Constants {
5963
* No-op singleton.
6064
*/
6165
@SuppressWarnings("rawtypes")
62-
static final IOTriConsumer IO_TRI_CONSUMER = (t, u, v) -> {/* No-op */};
66+
static final IOTriConsumer IO_TRI_CONSUMER = (t, u, v) -> {
67+
// noop
68+
};
6369

6470
private Constants() {
6571
// We don't want instances

src/main/java/org/apache/commons/io/function/IOConsumer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ public interface IOConsumer<T> {
3838
/**
3939
* Consider private.
4040
*/
41-
IOConsumer<?> NOOP_IO_CONSUMER = t -> {/* noop */};
41+
IOConsumer<?> NOOP_IO_CONSUMER = t -> {
42+
// noop
43+
};
4244

4345
/**
4446
* Performs an action for each element of the collection gathering any exceptions.

src/main/java/org/apache/commons/io/function/IOIntConsumer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ public interface IOIntConsumer {
3434
/**
3535
* The constant no-op consumer.
3636
*/
37-
IOIntConsumer NOOP = i -> {/* noop */};
37+
IOIntConsumer NOOP = i -> {
38+
// noop
39+
};
3840

3941
/**
4042
* Performs this operation on the given argument.

src/test/java/org/apache/commons/io/FileUtilsTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ private void backDateFile10Minutes(final File testFile) throws IOException {
193193

194194
private void consumeRemaining(final Iterator<File> iterator) {
195195
if (iterator != null) {
196-
iterator.forEachRemaining(e -> {});
196+
iterator.forEachRemaining(e -> {
197+
// noop
198+
});
197199
}
198200
}
199201

src/test/java/org/apache/commons/io/IOUtilsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,7 @@ public void testToByteArray_InputStream_SizeOne() throws Exception {
15281528

15291529
@Test
15301530
public void testToByteArray_InputStream_SizeZero() throws Exception {
1531-
try (InputStream fin =Files.newInputStream(testFilePath)) {
1531+
try (InputStream fin = Files.newInputStream(testFilePath)) {
15321532
final byte[] out = IOUtils.toByteArray(fin, 0);
15331533
assertNotNull(out, "Out cannot be null");
15341534
assertEquals(0, out.length, "Out length must be 0");

src/test/java/org/apache/commons/io/input/CharSequenceReaderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class CharSequenceReaderTest {
4141

4242
private void checkArray(final char[] expected, final char[] actual) {
4343
for (int i = 0; i < expected.length; i++) {
44-
assertEquals(expected[i], actual[i], "Compare[" +i + "]");
44+
assertEquals(expected[i], actual[i], "Compare[" + i + "]");
4545
}
4646
}
4747

src/test/java/org/apache/commons/io/output/CountingOutputStreamTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class CountingOutputStreamTest {
3333

3434
private void assertByteArrayEquals(final String msg, final byte[] array, final int start, final int end) {
3535
for (int i = start; i < end; i++) {
36-
assertEquals(array[i], i-start, msg+": array[" + i + "] mismatch");
36+
assertEquals(array[i], i - start, msg + ": array[" + i + "] mismatch");
3737
}
3838
}
3939

src/test/java/org/apache/commons/io/output/DeferredFileOutputStreamTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public void testThresholdNegative(final int initialBufferSize) throws IOExceptio
344344
@MethodSource("data")
345345
public void testThresholdReached(final int initialBufferSize) throws IOException {
346346
final File testFile = Files.createTempFile(tempDirPath, "testThresholdReached", "dat").toFile();
347-
final int threshold = testBytes.length /2;
347+
final int threshold = testBytes.length / 2;
348348
try (DeferredFileOutputStream out = DeferredFileOutputStream.builder()
349349
// @formatter:off
350350
.setThreshold(threshold)

0 commit comments

Comments
 (0)