You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by mi...@apache.org on 2017/11/18 20:35:53 UTC

logging-log4j2 git commit: Always delete temporary file created in test, before test also

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 91190aa54 -> b118dc624


Always delete temporary file created in test, before test also


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/b118dc62
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/b118dc62
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/b118dc62

Branch: refs/heads/master
Commit: b118dc624eed0b6638c6fbf292e4365c47f3ef76
Parents: 91190aa
Author: Mikael Ståldal <mi...@staldal.nu>
Authored: Sat Nov 18 21:35:46 2017 +0100
Committer: Mikael Ståldal <mi...@staldal.nu>
Committed: Sat Nov 18 21:35:46 2017 +0100

----------------------------------------------------------------------
 .../org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b118dc62/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java
----------------------------------------------------------------------
diff --git a/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java b/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java
index a5a8e67..dae9f41 100644
--- a/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java
+++ b/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java
@@ -162,13 +162,15 @@ public class Log4j1ConfigurationFactoryTest {
 	@Test
 	public void testSystemProperties1() throws Exception {
         final String tempFileName = System.getProperty("java.io.tmpdir") + "/hadoop.log";
+        final Path tempFilePath = new File(tempFileName).toPath();
+        Files.deleteIfExists(tempFilePath);
         try {
             final Configuration configuration = getConfiguration("config-1.2/log4j-system-properties-1.properties");
             final RollingFileAppender appender = configuration.getAppender("RFA");
             System.out.println("expected: " + tempFileName + " Actual: " + appender.getFileName());
             assertEquals(tempFileName, appender.getFileName());
         } finally {
-            Files.deleteIfExists(new File(tempFileName).toPath());
+            Files.deleteIfExists(tempFilePath);
         }
 	}