You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2019/09/13 12:27:40 UTC
[commons-io] branch master updated: Remove trailing white spaces on
all lines. More lambdas, less boilerplate.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git
The following commit(s) were added to refs/heads/master by this push:
new fc418a7 Remove trailing white spaces on all lines. More lambdas, less boilerplate.
fc418a7 is described below
commit fc418a7fb34a5af5d675c1398432bc9a4f8c802d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Sep 13 08:27:37 2019 -0400
Remove trailing white spaces on all lines.
More lambdas, less boilerplate.
---
.../org/apache/commons/io/IOIndexedException.java | 2 +-
.../apache/commons/io/input/BOMInputStream.java | 22 +++++++++-------------
.../commons/io/FileUtilsWaitForTestCase.java | 11 ++++-------
.../org/apache/commons/io/IOUtilsTestCase.java | 14 ++++----------
.../ValidatingObjectInputStreamTest.java | 7 +------
5 files changed, 19 insertions(+), 37 deletions(-)
diff --git a/src/main/java/org/apache/commons/io/IOIndexedException.java b/src/main/java/org/apache/commons/io/IOIndexedException.java
index 7b7e1c1..3f1dc75 100644
--- a/src/main/java/org/apache/commons/io/IOIndexedException.java
+++ b/src/main/java/org/apache/commons/io/IOIndexedException.java
@@ -42,7 +42,7 @@ public class IOIndexedException extends IOException {
/**
* Converts input to a suitable Stirng for exception message.
- *
+ *
* @param index An index into a source collection.
* @param cause A cause.
* @return A message.
diff --git a/src/main/java/org/apache/commons/io/input/BOMInputStream.java b/src/main/java/org/apache/commons/io/input/BOMInputStream.java
index 9ce7fa8..6bb7694 100644
--- a/src/main/java/org/apache/commons/io/input/BOMInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/BOMInputStream.java
@@ -137,20 +137,16 @@ public class BOMInputStream extends ProxyInputStream {
/**
* Compares ByteOrderMark objects in descending length order.
*/
- private static final Comparator<ByteOrderMark> ByteOrderMarkLengthComparator = new Comparator<ByteOrderMark>() {
-
- @Override
- public int compare(final ByteOrderMark bom1, final ByteOrderMark bom2) {
- final int len1 = bom1.length();
- final int len2 = bom2.length();
- if (len1 > len2) {
- return EOF;
- }
- if (len2 > len1) {
- return 1;
- }
- return 0;
+ private static final Comparator<ByteOrderMark> ByteOrderMarkLengthComparator = (bom1, bom2) -> {
+ final int len1 = bom1.length();
+ final int len2 = bom2.length();
+ if (len1 > len2) {
+ return EOF;
+ }
+ if (len2 > len1) {
+ return 1;
}
+ return 0;
};
/**
diff --git a/src/test/java/org/apache/commons/io/FileUtilsWaitForTestCase.java b/src/test/java/org/apache/commons/io/FileUtilsWaitForTestCase.java
index 293298c..c4081dd 100644
--- a/src/test/java/org/apache/commons/io/FileUtilsWaitForTestCase.java
+++ b/src/test/java/org/apache/commons/io/FileUtilsWaitForTestCase.java
@@ -44,13 +44,10 @@ public class FileUtilsWaitForTestCase {
public void testWaitForInterrupted() throws InterruptedException {
final AtomicBoolean wasInterrupted = new AtomicBoolean(false);
final CountDownLatch started = new CountDownLatch(1);
- final Runnable thread = new Runnable() {
- @Override
- public void run() {
- started.countDown();
- FileUtils.waitFor(new File(""), 2);
- wasInterrupted.set( Thread.currentThread().isInterrupted());
- }
+ final Runnable thread = () -> {
+ started.countDown();
+ FileUtils.waitFor(new File(""), 2);
+ wasInterrupted.set( Thread.currentThread().isInterrupted());
};
final Thread thread1 = new Thread(thread);
thread1.start();
diff --git a/src/test/java/org/apache/commons/io/IOUtilsTestCase.java b/src/test/java/org/apache/commons/io/IOUtilsTestCase.java
index f5b5d9d..2993772 100644
--- a/src/test/java/org/apache/commons/io/IOUtilsTestCase.java
+++ b/src/test/java/org/apache/commons/io/IOUtilsTestCase.java
@@ -142,21 +142,15 @@ public class IOUtilsTestCase {
}
@Test public void testCloseQuietly_AllCloseableIOException() {
- final Closeable closeable = new Closeable() {
- @Override
- public void close() throws IOException {
- throw new IOException();
- }
+ final Closeable closeable = () -> {
+ throw new IOException();
};
IOUtils.closeQuietly(closeable, null, closeable);
}
@Test public void testCloseQuietly_CloseableIOException() {
- IOUtils.closeQuietly(new Closeable() {
- @Override
- public void close() throws IOException {
- throw new IOException();
- }
+ IOUtils.closeQuietly((Closeable) () -> {
+ throw new IOException();
});
}
diff --git a/src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java b/src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java
index 3d68557..1df8f4f 100644
--- a/src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java
@@ -39,12 +39,7 @@ public class ValidatingObjectInputStreamTest extends ClosingBase {
private MockSerializedClass testObject;
private InputStream testStream;
- static private final ClassNameMatcher ALWAYS_TRUE = new ClassNameMatcher() {
- @Override
- public boolean matches(final String className) {
- return true;
- }
- };
+ static private final ClassNameMatcher ALWAYS_TRUE = className -> true;
@Override
@Before