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 2022/09/18 00:25:17 UTC

[commons-io] branch master updated (be656d35 -> 9c5b65b1)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git


    from be656d35 Make this test more reliable based on a failure seen on GitHub.
     new f46c153a Revert "Make this test more reliable based on a failure seen on GitHub."
     new 3639b2f6 Revert "Revert "Make this test more reliable based on a failure seen on GitHub.""
     new 9c5b65b1 Did not mean to add this (yet)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/commons/io/function/IOBaseStream.java   | 154 ---------------------
 1 file changed, 154 deletions(-)
 delete mode 100644 src/main/java/org/apache/commons/io/function/IOBaseStream.java


[commons-io] 03/03: Did not mean to add this (yet)

Posted by gg...@apache.org.
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

commit 9c5b65b1b7999af8f225015b562945c245053c11
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Sep 17 20:25:11 2022 -0400

    Did not mean to add this (yet)
---
 .../apache/commons/io/function/IOBaseStream.java   | 154 ---------------------
 1 file changed, 154 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/function/IOBaseStream.java b/src/main/java/org/apache/commons/io/function/IOBaseStream.java
deleted file mode 100644
index 6ac9bee2..00000000
--- a/src/main/java/org/apache/commons/io/function/IOBaseStream.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.io.function;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.io.UncheckedIOException;
-import java.util.stream.BaseStream;
-import java.util.stream.Stream;
-
-/**
- * Like {@link BaseStream} but throws {@link IOException}.
- *
- * @param <T> the type of the stream elements.
- * @param <S> the type of the IO stream extending {@code IOBaseStream}.
- * @param <B> the type of the stream extending {@code BaseStream}.
- * @since 2.12.0
- */
-public interface IOBaseStream<T, S extends IOBaseStream<T, S, B>, B extends BaseStream<T, B>> extends Closeable {
-
-    /**
-     * Creates a {@link BaseStream} for this instance that throws {@link UncheckedIOException} instead of
-     * {@link IOException}.
-     *
-     * @return an {@link UncheckedIOException} {@link BaseStream}.
-     */
-    @SuppressWarnings("unchecked")
-    default BaseStream<T, B> asBaseStream() {
-        return new UncheckedIOBaseStream<>((S) this);
-    }
-
-    /**
-     * Like {@link BaseStream#close()}.
-     *
-     * @see BaseStream#close()
-     */
-    @Override
-    default void close() {
-        unwrap().close();
-    }
-
-    /**
-     * Like {@link BaseStream#isParallel()}.
-     *
-     * @return See {@link BaseStream#isParallel() delegate}.
-     * @see BaseStream#isParallel()
-     */
-    @SuppressWarnings("resource") // for unwrap()
-    default boolean isParallel() {
-        return unwrap().isParallel();
-    }
-
-    /**
-     * Like {@link BaseStream#iterator()}.
-     *
-     * @return See {@link BaseStream#iterator() delegate}.
-     * @see BaseStream#iterator()
-     */
-    @SuppressWarnings("resource") // for unwrap()
-    default IOIterator<T> iterator() {
-        return IOIteratorAdapter.adapt(unwrap().iterator());
-    }
-
-    /**
-     * Like {@link BaseStream#onClose(Runnable)}.
-     *
-     * @param closeHandler See {@link BaseStream#onClose(Runnable) delegate}.
-     * @return See {@link BaseStream#onClose(Runnable) delegate}.
-     * @throws IOException if an I/O error occurs.
-     * @see BaseStream#onClose(Runnable)
-     */
-    @SuppressWarnings({"unused", "resource"}) // throws IOException, unwrap()
-    default S onClose(final IORunnable closeHandler) throws IOException {
-        return wrap(unwrap().onClose(() -> Erase.run(closeHandler)));
-    }
-
-    /**
-     * Like {@link BaseStream#parallel()}.
-     *
-     * @return See {@link BaseStream#parallel() delegate}.
-     * @see BaseStream#parallel()
-     */
-    @SuppressWarnings({"resource", "unchecked"}) // for unwrap(), this
-    default S parallel() {
-        return isParallel() ? (S) this : wrap(unwrap().parallel());
-    }
-
-    /**
-     * Like {@link BaseStream#sequential()}.
-     *
-     * @return See {@link BaseStream#sequential() delegate}.
-     * @see BaseStream#sequential()
-     */
-    @SuppressWarnings({"resource", "unchecked"}) // for unwrap(), this
-    default S sequential() {
-        return isParallel() ? wrap(unwrap().sequential()) : (S) this;
-    }
-
-    /**
-     * Like {@link BaseStream#spliterator()}.
-     *
-     * @return See {@link BaseStream#spliterator() delegate}.
-     * @see BaseStream#spliterator()
-     */
-    @SuppressWarnings("resource") // for unwrap()
-    default IOSpliterator<T> spliterator() {
-        return IOSpliteratorAdapter.adapt(unwrap().spliterator());
-    }
-
-    /**
-     * Like {@link BaseStream#unordered()}.
-     *
-     * @return See {@link BaseStream#unordered() delegate}.
-     * @see java.util.stream.BaseStream#unordered()
-     */
-    @SuppressWarnings("resource") // for unwrap()
-    default S unordered() {
-        return wrap(unwrap().unordered());
-    }
-
-    /**
-     * Unwraps this instance and returns the underlying {@link Stream}.
-     * <p>
-     * Implementations may not have anything to unwrap and that behavior is undefined for now.
-     * </p>
-     *
-     * @return the underlying stream.
-     */
-    B unwrap();
-
-    /**
-     * Wraps a {@link Stream}.
-     *
-     * @param delegate The delegate.
-     * @return An IO stream.
-     */
-    S wrap(B delegate);
-
-}


[commons-io] 01/03: Revert "Make this test more reliable based on a failure seen on GitHub."

Posted by gg...@apache.org.
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

commit f46c153a8b8194c7674cb975b86a6f1696189317
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Sep 17 20:22:47 2022 -0400

    Revert "Make this test more reliable based on a failure seen on GitHub."
    
    This reverts commit be656d35fc0e248a14248ac47857bb7b2bbfd5fc.
---
 .../apache/commons/io/function/IOBaseStream.java   | 154 ---------------------
 .../apache/commons/io/FileUtilsWaitForTest.java    |   6 +-
 2 files changed, 2 insertions(+), 158 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/function/IOBaseStream.java b/src/main/java/org/apache/commons/io/function/IOBaseStream.java
deleted file mode 100644
index 6ac9bee2..00000000
--- a/src/main/java/org/apache/commons/io/function/IOBaseStream.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.io.function;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.io.UncheckedIOException;
-import java.util.stream.BaseStream;
-import java.util.stream.Stream;
-
-/**
- * Like {@link BaseStream} but throws {@link IOException}.
- *
- * @param <T> the type of the stream elements.
- * @param <S> the type of the IO stream extending {@code IOBaseStream}.
- * @param <B> the type of the stream extending {@code BaseStream}.
- * @since 2.12.0
- */
-public interface IOBaseStream<T, S extends IOBaseStream<T, S, B>, B extends BaseStream<T, B>> extends Closeable {
-
-    /**
-     * Creates a {@link BaseStream} for this instance that throws {@link UncheckedIOException} instead of
-     * {@link IOException}.
-     *
-     * @return an {@link UncheckedIOException} {@link BaseStream}.
-     */
-    @SuppressWarnings("unchecked")
-    default BaseStream<T, B> asBaseStream() {
-        return new UncheckedIOBaseStream<>((S) this);
-    }
-
-    /**
-     * Like {@link BaseStream#close()}.
-     *
-     * @see BaseStream#close()
-     */
-    @Override
-    default void close() {
-        unwrap().close();
-    }
-
-    /**
-     * Like {@link BaseStream#isParallel()}.
-     *
-     * @return See {@link BaseStream#isParallel() delegate}.
-     * @see BaseStream#isParallel()
-     */
-    @SuppressWarnings("resource") // for unwrap()
-    default boolean isParallel() {
-        return unwrap().isParallel();
-    }
-
-    /**
-     * Like {@link BaseStream#iterator()}.
-     *
-     * @return See {@link BaseStream#iterator() delegate}.
-     * @see BaseStream#iterator()
-     */
-    @SuppressWarnings("resource") // for unwrap()
-    default IOIterator<T> iterator() {
-        return IOIteratorAdapter.adapt(unwrap().iterator());
-    }
-
-    /**
-     * Like {@link BaseStream#onClose(Runnable)}.
-     *
-     * @param closeHandler See {@link BaseStream#onClose(Runnable) delegate}.
-     * @return See {@link BaseStream#onClose(Runnable) delegate}.
-     * @throws IOException if an I/O error occurs.
-     * @see BaseStream#onClose(Runnable)
-     */
-    @SuppressWarnings({"unused", "resource"}) // throws IOException, unwrap()
-    default S onClose(final IORunnable closeHandler) throws IOException {
-        return wrap(unwrap().onClose(() -> Erase.run(closeHandler)));
-    }
-
-    /**
-     * Like {@link BaseStream#parallel()}.
-     *
-     * @return See {@link BaseStream#parallel() delegate}.
-     * @see BaseStream#parallel()
-     */
-    @SuppressWarnings({"resource", "unchecked"}) // for unwrap(), this
-    default S parallel() {
-        return isParallel() ? (S) this : wrap(unwrap().parallel());
-    }
-
-    /**
-     * Like {@link BaseStream#sequential()}.
-     *
-     * @return See {@link BaseStream#sequential() delegate}.
-     * @see BaseStream#sequential()
-     */
-    @SuppressWarnings({"resource", "unchecked"}) // for unwrap(), this
-    default S sequential() {
-        return isParallel() ? wrap(unwrap().sequential()) : (S) this;
-    }
-
-    /**
-     * Like {@link BaseStream#spliterator()}.
-     *
-     * @return See {@link BaseStream#spliterator() delegate}.
-     * @see BaseStream#spliterator()
-     */
-    @SuppressWarnings("resource") // for unwrap()
-    default IOSpliterator<T> spliterator() {
-        return IOSpliteratorAdapter.adapt(unwrap().spliterator());
-    }
-
-    /**
-     * Like {@link BaseStream#unordered()}.
-     *
-     * @return See {@link BaseStream#unordered() delegate}.
-     * @see java.util.stream.BaseStream#unordered()
-     */
-    @SuppressWarnings("resource") // for unwrap()
-    default S unordered() {
-        return wrap(unwrap().unordered());
-    }
-
-    /**
-     * Unwraps this instance and returns the underlying {@link Stream}.
-     * <p>
-     * Implementations may not have anything to unwrap and that behavior is undefined for now.
-     * </p>
-     *
-     * @return the underlying stream.
-     */
-    B unwrap();
-
-    /**
-     * Wraps a {@link Stream}.
-     *
-     * @param delegate The delegate.
-     * @return An IO stream.
-     */
-    S wrap(B delegate);
-
-}
diff --git a/src/test/java/org/apache/commons/io/FileUtilsWaitForTest.java b/src/test/java/org/apache/commons/io/FileUtilsWaitForTest.java
index a5f6a0f1..50af4a2f 100644
--- a/src/test/java/org/apache/commons/io/FileUtilsWaitForTest.java
+++ b/src/test/java/org/apache/commons/io/FileUtilsWaitForTest.java
@@ -44,15 +44,13 @@ public class FileUtilsWaitForTest {
     @Test
     public void testWaitForInterrupted() throws InterruptedException {
         final AtomicBoolean wasInterrupted = new AtomicBoolean();
-        final CountDownLatch started = new CountDownLatch(2);
-        final int seconds = 10;
+        final CountDownLatch started = new CountDownLatch(1);
         final Thread thread1 = new Thread(() -> {
             started.countDown();
-            assertTrue(FileUtils.waitFor(FileUtils.current(), seconds));
+            assertTrue(FileUtils.waitFor(FileUtils.current(), 10));
             wasInterrupted.set(Thread.currentThread().isInterrupted());
         });
         thread1.start();
-        started.countDown();
         thread1.interrupt();
         started.await();
         thread1.join();


[commons-io] 02/03: Revert "Revert "Make this test more reliable based on a failure seen on GitHub.""

Posted by gg...@apache.org.
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

commit 3639b2f6a433e4948bd00bd9f027a459e9f829c6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Sep 17 20:23:09 2022 -0400

    Revert "Revert "Make this test more reliable based on a failure seen on GitHub.""
    
    This reverts commit f46c153a8b8194c7674cb975b86a6f1696189317.
---
 .../apache/commons/io/function/IOBaseStream.java   | 154 +++++++++++++++++++++
 .../apache/commons/io/FileUtilsWaitForTest.java    |   6 +-
 2 files changed, 158 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/function/IOBaseStream.java b/src/main/java/org/apache/commons/io/function/IOBaseStream.java
new file mode 100644
index 00000000..6ac9bee2
--- /dev/null
+++ b/src/main/java/org/apache/commons/io/function/IOBaseStream.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.io.function;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.util.stream.BaseStream;
+import java.util.stream.Stream;
+
+/**
+ * Like {@link BaseStream} but throws {@link IOException}.
+ *
+ * @param <T> the type of the stream elements.
+ * @param <S> the type of the IO stream extending {@code IOBaseStream}.
+ * @param <B> the type of the stream extending {@code BaseStream}.
+ * @since 2.12.0
+ */
+public interface IOBaseStream<T, S extends IOBaseStream<T, S, B>, B extends BaseStream<T, B>> extends Closeable {
+
+    /**
+     * Creates a {@link BaseStream} for this instance that throws {@link UncheckedIOException} instead of
+     * {@link IOException}.
+     *
+     * @return an {@link UncheckedIOException} {@link BaseStream}.
+     */
+    @SuppressWarnings("unchecked")
+    default BaseStream<T, B> asBaseStream() {
+        return new UncheckedIOBaseStream<>((S) this);
+    }
+
+    /**
+     * Like {@link BaseStream#close()}.
+     *
+     * @see BaseStream#close()
+     */
+    @Override
+    default void close() {
+        unwrap().close();
+    }
+
+    /**
+     * Like {@link BaseStream#isParallel()}.
+     *
+     * @return See {@link BaseStream#isParallel() delegate}.
+     * @see BaseStream#isParallel()
+     */
+    @SuppressWarnings("resource") // for unwrap()
+    default boolean isParallel() {
+        return unwrap().isParallel();
+    }
+
+    /**
+     * Like {@link BaseStream#iterator()}.
+     *
+     * @return See {@link BaseStream#iterator() delegate}.
+     * @see BaseStream#iterator()
+     */
+    @SuppressWarnings("resource") // for unwrap()
+    default IOIterator<T> iterator() {
+        return IOIteratorAdapter.adapt(unwrap().iterator());
+    }
+
+    /**
+     * Like {@link BaseStream#onClose(Runnable)}.
+     *
+     * @param closeHandler See {@link BaseStream#onClose(Runnable) delegate}.
+     * @return See {@link BaseStream#onClose(Runnable) delegate}.
+     * @throws IOException if an I/O error occurs.
+     * @see BaseStream#onClose(Runnable)
+     */
+    @SuppressWarnings({"unused", "resource"}) // throws IOException, unwrap()
+    default S onClose(final IORunnable closeHandler) throws IOException {
+        return wrap(unwrap().onClose(() -> Erase.run(closeHandler)));
+    }
+
+    /**
+     * Like {@link BaseStream#parallel()}.
+     *
+     * @return See {@link BaseStream#parallel() delegate}.
+     * @see BaseStream#parallel()
+     */
+    @SuppressWarnings({"resource", "unchecked"}) // for unwrap(), this
+    default S parallel() {
+        return isParallel() ? (S) this : wrap(unwrap().parallel());
+    }
+
+    /**
+     * Like {@link BaseStream#sequential()}.
+     *
+     * @return See {@link BaseStream#sequential() delegate}.
+     * @see BaseStream#sequential()
+     */
+    @SuppressWarnings({"resource", "unchecked"}) // for unwrap(), this
+    default S sequential() {
+        return isParallel() ? wrap(unwrap().sequential()) : (S) this;
+    }
+
+    /**
+     * Like {@link BaseStream#spliterator()}.
+     *
+     * @return See {@link BaseStream#spliterator() delegate}.
+     * @see BaseStream#spliterator()
+     */
+    @SuppressWarnings("resource") // for unwrap()
+    default IOSpliterator<T> spliterator() {
+        return IOSpliteratorAdapter.adapt(unwrap().spliterator());
+    }
+
+    /**
+     * Like {@link BaseStream#unordered()}.
+     *
+     * @return See {@link BaseStream#unordered() delegate}.
+     * @see java.util.stream.BaseStream#unordered()
+     */
+    @SuppressWarnings("resource") // for unwrap()
+    default S unordered() {
+        return wrap(unwrap().unordered());
+    }
+
+    /**
+     * Unwraps this instance and returns the underlying {@link Stream}.
+     * <p>
+     * Implementations may not have anything to unwrap and that behavior is undefined for now.
+     * </p>
+     *
+     * @return the underlying stream.
+     */
+    B unwrap();
+
+    /**
+     * Wraps a {@link Stream}.
+     *
+     * @param delegate The delegate.
+     * @return An IO stream.
+     */
+    S wrap(B delegate);
+
+}
diff --git a/src/test/java/org/apache/commons/io/FileUtilsWaitForTest.java b/src/test/java/org/apache/commons/io/FileUtilsWaitForTest.java
index 50af4a2f..a5f6a0f1 100644
--- a/src/test/java/org/apache/commons/io/FileUtilsWaitForTest.java
+++ b/src/test/java/org/apache/commons/io/FileUtilsWaitForTest.java
@@ -44,13 +44,15 @@ public class FileUtilsWaitForTest {
     @Test
     public void testWaitForInterrupted() throws InterruptedException {
         final AtomicBoolean wasInterrupted = new AtomicBoolean();
-        final CountDownLatch started = new CountDownLatch(1);
+        final CountDownLatch started = new CountDownLatch(2);
+        final int seconds = 10;
         final Thread thread1 = new Thread(() -> {
             started.countDown();
-            assertTrue(FileUtils.waitFor(FileUtils.current(), 10));
+            assertTrue(FileUtils.waitFor(FileUtils.current(), seconds));
             wasInterrupted.set(Thread.currentThread().isInterrupted());
         });
         thread1.start();
+        started.countDown();
         thread1.interrupt();
         started.await();
         thread1.join();