From 92a3f17532623812627c78725e15a23e4aa120f1 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 13 Apr 2015 14:37:17 +1000 Subject: [PATCH 1/2] 464438 ClassFileTransformer support in org.eclipse.jetty.webapp.WebAppClassLoader broken --- .../eclipse/jetty/webapp/WebAppClassLoader.java | 8 ++++++-- .../jetty/webapp/WebAppClassLoaderTest.java | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java index 7538e81c2f5..fa30de5e9e5 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppClassLoader.java @@ -519,10 +519,14 @@ public class WebAppClassLoader extends URLClassLoader try { content = url.openStream(); - byte[] bytes =IO.readBytes(content); + byte[] bytes = IO.readBytes(content); for (ClassFileTransformer transformer : _transformers) - bytes=transformer.transform(this,name,null,null,bytes); + { + byte[] tmp = transformer.transform(this,name,null,null,bytes); + if (tmp != null) + bytes = tmp; + } clazz=defineClass(name,bytes,0,bytes.length); } diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppClassLoaderTest.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppClassLoaderTest.java index 3ec8e2bad3e..49011ab0b7f 100644 --- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppClassLoaderTest.java +++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppClassLoaderTest.java @@ -137,7 +137,22 @@ public class WebAppClassLoaderTest assertEquals(_loader,iter.next()); assertEquals("org.acme.other.ClassInClassesC",iter.next()); assertFalse(iter.hasNext()); - + } + + @Test + public void testNullClassFileTransformer () throws Exception + { + _loader.addTransformer(new ClassFileTransformer() + { + public byte[] transform(ClassLoader loader, String className, Class classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) + throws IllegalClassFormatException + { + return null; + } + }); + + + assertTrue(canLoadClass("org.acme.webapp.ClassInJarA")); } @Test From 6fa863d6be097c93126b6b7e45b2126b247c62c7 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Wed, 15 Apr 2015 19:09:46 +0200 Subject: [PATCH 2/2] Updated ALPN and NPN versions for JDK 7u79, 7u80 and 8u45. --- .../modules/protonego-impl/alpn-1.7.0_79.mod | 8 ++++ .../modules/protonego-impl/alpn-1.7.0_80.mod | 8 ++++ .../modules/protonego-impl/alpn-1.8.0_45.mod | 8 ++++ .../modules/protonego-impl/npn-1.7.0_79.mod | 8 ++++ .../modules/protonego-impl/npn-1.7.0_80.mod | 8 ++++ .../jetty/spdy/server/NPNModuleTest.java | 1 + .../modules/protonego-impl/alpn-1.7.0_79.mod | 8 ++++ .../modules/protonego-impl/alpn-1.7.0_80.mod | 8 ++++ .../modules/protonego-impl/alpn-1.8.0_45.mod | 8 ++++ .../modules/protonego-impl/npn-1.7.0_79.mod | 8 ++++ .../modules/protonego-impl/npn-1.7.0_80.mod | 8 ++++ pom.xml | 38 +++++++++++++++++++ 12 files changed, 119 insertions(+) create mode 100644 jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_79.mod create mode 100644 jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_80.mod create mode 100644 jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_45.mod create mode 100644 jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_79.mod create mode 100644 jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_80.mod create mode 100644 jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.7.0_79.mod create mode 100644 jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.7.0_80.mod create mode 100644 jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.8.0_45.mod create mode 100644 jetty-start/src/test/resources/dist-home/modules/protonego-impl/npn-1.7.0_79.mod create mode 100644 jetty-start/src/test/resources/dist-home/modules/protonego-impl/npn-1.7.0_80.mod diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_79.mod b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_79.mod new file mode 100644 index 00000000000..ac315d6df7d --- /dev/null +++ b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_79.mod @@ -0,0 +1,8 @@ +[name] +protonego-boot + +[files] +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.1.3.v20150130/alpn-boot-7.1.3.v20150130.jar|lib/alpn/alpn-boot-7.1.3.v20150130.jar + +[exec] +-Xbootclasspath/p:lib/alpn/alpn-boot-7.1.3.v20150130.jar diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_80.mod b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_80.mod new file mode 100644 index 00000000000..ac315d6df7d --- /dev/null +++ b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.7.0_80.mod @@ -0,0 +1,8 @@ +[name] +protonego-boot + +[files] +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.1.3.v20150130/alpn-boot-7.1.3.v20150130.jar|lib/alpn/alpn-boot-7.1.3.v20150130.jar + +[exec] +-Xbootclasspath/p:lib/alpn/alpn-boot-7.1.3.v20150130.jar diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_45.mod b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_45.mod new file mode 100644 index 00000000000..41149793194 --- /dev/null +++ b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn-1.8.0_45.mod @@ -0,0 +1,8 @@ +[name] +protonego-boot + +[files] +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.3.v20150130/alpn-boot-8.1.3.v20150130.jar|lib/alpn/alpn-boot-8.1.3.v20150130.jar + +[exec] +-Xbootclasspath/p:lib/alpn/alpn-boot-8.1.3.v20150130.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_79.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_79.mod new file mode 100644 index 00000000000..a5fac1140cd --- /dev/null +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_79.mod @@ -0,0 +1,8 @@ +[name] +protonego-boot + +[files] +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.10.v20150130/npn-boot-1.1.10.v20150130.jar|lib/npn/npn-boot-1.1.10.v20150130.jar + +[exec] +-Xbootclasspath/p:lib/npn/npn-boot-1.1.10.v20150130.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_80.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_80.mod new file mode 100644 index 00000000000..2cce5fab7c8 --- /dev/null +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/protonego-impl/npn-1.7.0_80.mod @@ -0,0 +1,8 @@ +[name] +protonego-boot + +[files] +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.11.v20150415/npn-boot-1.1.11.v20150415.jar|lib/npn/npn-boot-1.1.11.v20150415.jar + +[exec] +-Xbootclasspath/p:lib/npn/npn-boot-1.1.11.v20150415.jar diff --git a/jetty-spdy/spdy-npn-tests/src/test/java/org/eclipse/jetty/spdy/server/NPNModuleTest.java b/jetty-spdy/spdy-npn-tests/src/test/java/org/eclipse/jetty/spdy/server/NPNModuleTest.java index e4bd38550cf..c2497eb94a7 100644 --- a/jetty-spdy/spdy-npn-tests/src/test/java/org/eclipse/jetty/spdy/server/NPNModuleTest.java +++ b/jetty-spdy/spdy-npn-tests/src/test/java/org/eclipse/jetty/spdy/server/NPNModuleTest.java @@ -59,6 +59,7 @@ public class NPNModuleTest static { /** The main() method in this test case can be run to validate this list independently */ + KNOWN_GOOD_NPN_URLS.add("http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.11.v20150415/npn-boot-1.1.11.v20150415.jar"); KNOWN_GOOD_NPN_URLS.add("http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.10.v20150130/npn-boot-1.1.10.v20150130.jar"); KNOWN_GOOD_NPN_URLS.add("http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.9.v20141016/npn-boot-1.1.9.v20141016.jar"); KNOWN_GOOD_NPN_URLS.add("http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.8.v20141013/npn-boot-1.1.8.v20141013.jar"); diff --git a/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.7.0_79.mod b/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.7.0_79.mod new file mode 100644 index 00000000000..ac315d6df7d --- /dev/null +++ b/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.7.0_79.mod @@ -0,0 +1,8 @@ +[name] +protonego-boot + +[files] +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.1.3.v20150130/alpn-boot-7.1.3.v20150130.jar|lib/alpn/alpn-boot-7.1.3.v20150130.jar + +[exec] +-Xbootclasspath/p:lib/alpn/alpn-boot-7.1.3.v20150130.jar diff --git a/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.7.0_80.mod b/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.7.0_80.mod new file mode 100644 index 00000000000..ac315d6df7d --- /dev/null +++ b/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.7.0_80.mod @@ -0,0 +1,8 @@ +[name] +protonego-boot + +[files] +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/7.1.3.v20150130/alpn-boot-7.1.3.v20150130.jar|lib/alpn/alpn-boot-7.1.3.v20150130.jar + +[exec] +-Xbootclasspath/p:lib/alpn/alpn-boot-7.1.3.v20150130.jar diff --git a/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.8.0_45.mod b/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.8.0_45.mod new file mode 100644 index 00000000000..41149793194 --- /dev/null +++ b/jetty-start/src/test/resources/dist-home/modules/protonego-impl/alpn-1.8.0_45.mod @@ -0,0 +1,8 @@ +[name] +protonego-boot + +[files] +http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.3.v20150130/alpn-boot-8.1.3.v20150130.jar|lib/alpn/alpn-boot-8.1.3.v20150130.jar + +[exec] +-Xbootclasspath/p:lib/alpn/alpn-boot-8.1.3.v20150130.jar diff --git a/jetty-start/src/test/resources/dist-home/modules/protonego-impl/npn-1.7.0_79.mod b/jetty-start/src/test/resources/dist-home/modules/protonego-impl/npn-1.7.0_79.mod new file mode 100644 index 00000000000..a5fac1140cd --- /dev/null +++ b/jetty-start/src/test/resources/dist-home/modules/protonego-impl/npn-1.7.0_79.mod @@ -0,0 +1,8 @@ +[name] +protonego-boot + +[files] +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.10.v20150130/npn-boot-1.1.10.v20150130.jar|lib/npn/npn-boot-1.1.10.v20150130.jar + +[exec] +-Xbootclasspath/p:lib/npn/npn-boot-1.1.10.v20150130.jar diff --git a/jetty-start/src/test/resources/dist-home/modules/protonego-impl/npn-1.7.0_80.mod b/jetty-start/src/test/resources/dist-home/modules/protonego-impl/npn-1.7.0_80.mod new file mode 100644 index 00000000000..2cce5fab7c8 --- /dev/null +++ b/jetty-start/src/test/resources/dist-home/modules/protonego-impl/npn-1.7.0_80.mod @@ -0,0 +1,8 @@ +[name] +protonego-boot + +[files] +http://central.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.11.v20150415/npn-boot-1.1.11.v20150415.jar|lib/npn/npn-boot-1.1.11.v20150415.jar + +[exec] +-Xbootclasspath/p:lib/npn/npn-boot-1.1.11.v20150415.jar diff --git a/pom.xml b/pom.xml index a50bc84c389..db5c6378b2e 100644 --- a/pom.xml +++ b/pom.xml @@ -981,6 +981,32 @@ 7.1.3.v20150130 + + 7u79 + + + java.version + 1.7.0_79 + + + + 1.1.10.v20150130 + 7.1.3.v20150130 + + + + 7u80 + + + java.version + 1.7.0_80 + + + + 1.1.11.v20150415 + 7.1.3.v20150130 + + 8u00 @@ -1065,5 +1091,17 @@ 8.1.3.v20150130 + + 8u45 + + + java.version + 1.8.0_45 + + + + 8.1.3.v20150130 + +