You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2018/03/01 19:11:18 UTC

logging-log4j2 git commit: [LOG4J2-2279] Allow SystemPropertiesPropertySource to run with a SecurityManager that rejects system property access. This test passes for me on Windows 10 but fails on Jenkins. Reorder a sanity check so that it takes place bef

Repository: logging-log4j2
Updated Branches:
  refs/heads/release-2.x b19c18e3f -> 59a8efed0


[LOG4J2-2279] Allow SystemPropertiesPropertySource to run with a
SecurityManager that rejects system property access. This test passes
for me on Windows 10 but fails on Jenkins. Reorder a sanity check so
that it takes place before the SecurityManager test rule is evaluated.

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

Branch: refs/heads/release-2.x
Commit: 59a8efed01dbc94c335e24222cc28039070f72a0
Parents: b19c18e
Author: Gary Gregory <ga...@gmail.com>
Authored: Thu Mar 1 12:11:14 2018 -0700
Committer: Gary Gregory <ga...@gmail.com>
Committed: Thu Mar 1 12:11:14 2018 -0700

----------------------------------------------------------------------
 .../PropertyFilePropertySourceSecurityManagerIT.java     | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/59a8efed/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertyFilePropertySourceSecurityManagerIT.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertyFilePropertySourceSecurityManagerIT.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertyFilePropertySourceSecurityManagerIT.java
index a6679d6..e59e77e 100644
--- a/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertyFilePropertySourceSecurityManagerIT.java
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertyFilePropertySourceSecurityManagerIT.java
@@ -25,6 +25,7 @@ import java.util.PropertyPermission;
 
 import org.apache.logging.log4j.junit.SecurityManagerTestRule;
 import org.junit.Assert;
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 
@@ -43,6 +44,11 @@ import org.junit.Test;
  */
 public class PropertyFilePropertySourceSecurityManagerIT {
 
+	@BeforeClass
+	public static void beforeClass() {
+		Assert.assertTrue(TEST_FIXTURE_PATH, Files.exists(Paths.get(TEST_FIXTURE_PATH)));
+	}
+	
 	@Rule
 	public final SecurityManagerTestRule rule = new SecurityManagerTestRule(new TestSecurityManager());
 
@@ -55,7 +61,7 @@ public class PropertyFilePropertySourceSecurityManagerIT {
 	private class TestSecurityManager extends SecurityManager {
 
 		@Override
-		public void checkPermission(Permission permission) {
+		public void checkPermission(final Permission permission) {
 			if (permission instanceof FilePermission && permission.getName().endsWith(TEST_FIXTURE_PATH)) {
 				throw new SecurityException();
 			}
@@ -72,8 +78,7 @@ public class PropertyFilePropertySourceSecurityManagerIT {
 	 */
 	@Test
 	public void test() {
-		Assert.assertTrue(TEST_FIXTURE_PATH, Files.exists(Paths.get(TEST_FIXTURE_PATH)));
-		PropertiesUtil propertiesUtil = new PropertiesUtil(TEST_FIXTURE_PATH);
+		final PropertiesUtil propertiesUtil = new PropertiesUtil(TEST_FIXTURE_PATH);
 		Assert.assertEquals(null, propertiesUtil.getStringProperty("a.1"));
 	}
 }