From 7b43d9b0ec4649ba96b7649310b962c392df698a Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 6 Sep 2016 05:55:06 -0400 Subject: [PATCH] Add test for Log4j throwable proxy leniency We have intentionally introduced leniency for ThrowableProxy from Log4j to work around a bug there. Yet, a test for this introduced leniency was not addded. This commit introduces such a test. Relates #20329 --- .../test/java/org/elasticsearch/bootstrap/JarHellTests.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/src/test/java/org/elasticsearch/bootstrap/JarHellTests.java b/core/src/test/java/org/elasticsearch/bootstrap/JarHellTests.java index e79eeb9a985..5aaadc4a389 100644 --- a/core/src/test/java/org/elasticsearch/bootstrap/JarHellTests.java +++ b/core/src/test/java/org/elasticsearch/bootstrap/JarHellTests.java @@ -117,6 +117,12 @@ public class JarHellTests extends ESTestCase { JarHell.checkJarHell(jars); } + public void testLog4jThrowableProxyLeniency() throws Exception { + Path dir = createTempDir(); + URL[] jars = {makeJar(dir, "foo.jar", null, "org.apache.logging.log4j.core.impl.ThrowableProxy.class"), makeJar(dir, "bar.jar", null, "org.apache.logging.log4j.core.impl.ThrowableProxy.class")}; + JarHell.checkJarHell(jars); + } + public void testWithinSingleJar() throws Exception { // the java api for zip file does not allow creating duplicate entries (good!) so // this bogus jar had to be constructed with ant