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

ggregory pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/release-2.x by this push:
     new b4cdb24  The policy uses the file creation time for its comparison. 
The test now also sets the file creation time. Without this change, the test 
fails for me on Windows 10 and Oracle 8.
b4cdb24 is described below

commit b4cdb24d4307fc1fb2ecfe6f4e3cb39b3448163c
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Nov 29 18:55:57 2018 -0700

    The policy uses the file creation time for its comparison. The test now
    also sets the file creation time. Without this change, the test fails
    for me on Windows 10 and Oracle 8.
---
 .../log4j/core/appender/rolling/OnStartupTriggeringPolicyTest.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/OnStartupTriggeringPolicyTest.java
 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/OnStartupTriggeringPolicyTest.java
index 72ae6f0..5f26338 100644
--- 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/OnStartupTriggeringPolicyTest.java
+++ 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/rolling/OnStartupTriggeringPolicyTest.java
@@ -26,6 +26,8 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
+import java.nio.file.attribute.BasicFileAttributeView;
+import java.nio.file.attribute.FileTime;
 import java.util.Arrays;
 
 import org.apache.logging.log4j.core.config.Configuration;
@@ -74,7 +76,9 @@ public class OnStartupTriggeringPolicyTest {
         assertTrue(size > 0);
         assertEquals(copied, size);
 
-        Assert.assertTrue(target.toFile().setLastModified(timeStamp));
+        final FileTime fileTime = FileTime.fromMillis(timeStamp);
+        final BasicFileAttributeView attrs = 
Files.getFileAttributeView(target, BasicFileAttributeView.class);
+        attrs.setTimes(fileTime, fileTime, fileTime);
         final PatternLayout layout = 
PatternLayout.newBuilder().withPattern("%msg").withConfiguration(configuration)
                 .build();
         final RolloverStrategy strategy = 
DefaultRolloverStrategy.createStrategy(null, null, null, "0", null, true,

Reply via email to