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/08/13 16:15:13 UTC

[commons-io] branch master updated: Try to fix build on GitHub for Windows and Java 17.

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 7ced1e85 Try to fix build on GitHub for Windows and Java 17.
7ced1e85 is described below

commit 7ced1e8575ce73271d43f16480e6edca28bb033b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 13 12:15:09 2022 -0400

    Try to fix build on GitHub for Windows and Java 17.
    
    Java 8 instant resolution is not great.
---
 .../org/apache/commons/io/input/TimestampedObserverTest.java  | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/test/java/org/apache/commons/io/input/TimestampedObserverTest.java b/src/test/java/org/apache/commons/io/input/TimestampedObserverTest.java
index 0785e4a1..c80527e3 100644
--- a/src/test/java/org/apache/commons/io/input/TimestampedObserverTest.java
+++ b/src/test/java/org/apache/commons/io/input/TimestampedObserverTest.java
@@ -36,17 +36,18 @@ public class TimestampedObserverTest {
     @Test
     public void test() throws IOException, InterruptedException {
         final Instant before = Instant.now();
-        Thread.sleep(20); // Some OS' clock granularity may be high.
+        // Some OS' clock granularity may be high.
+        Thread.sleep(20);
         final TimestampedObserver timestampedObserver = new TimestampedObserver();
+        // Java 8 instant resolution is not great.
+        Thread.sleep(20);
         // toString() should not blow up before close().
         assertNotNull(timestampedObserver.toString());
         assertTrue(timestampedObserver.getOpenInstant().isAfter(before));
         assertTrue(timestampedObserver.getOpenToNowDuration().toNanos() > 0);
         assertNull(timestampedObserver.getCloseInstant());
-        final byte[] buffer = MessageDigestCalculatingInputStreamTest
-            .generateRandomByteStream(IOUtils.DEFAULT_BUFFER_SIZE);
-        try (ObservableInputStream ois = new ObservableInputStream(new ByteArrayInputStream(buffer),
-            timestampedObserver)) {
+        final byte[] buffer = MessageDigestCalculatingInputStreamTest.generateRandomByteStream(IOUtils.DEFAULT_BUFFER_SIZE);
+        try (ObservableInputStream ois = new ObservableInputStream(new ByteArrayInputStream(buffer), timestampedObserver)) {
             assertTrue(timestampedObserver.getOpenInstant().isAfter(before));
             assertTrue(timestampedObserver.getOpenToNowDuration().toNanos() > 0);
         }