From 1fc9d38396df499ecdb29d28f5f180441e6a60dd Mon Sep 17 00:00:00 2001 From: cemo Date: Sun, 28 Dec 2014 02:23:36 +0200 Subject: [PATCH] Fix potential Jetty MalformedURLException Update JettyEmbeddedServletContainerFactory to use the JarResource class to create the base resource. This prevents a potential "java.lang.NullPointerException: no !/ in spec" error which can occur when using shaded executable jars. Fixes gh-2245 --- .../embedded/jetty/JettyEmbeddedServletContainerFactory.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java index 0767b52755..4aa6ebc2e5 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java @@ -40,6 +40,7 @@ import org.eclipse.jetty.server.handler.ErrorHandler; import org.eclipse.jetty.servlet.ErrorPageErrorHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.servlet.ServletMapping; +import org.eclipse.jetty.util.resource.JarResource; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.webapp.AbstractConfiguration; @@ -259,7 +260,8 @@ public class JettyEmbeddedServletContainerFactory extends if (root != null) { try { if (!root.isDirectory()) { - Resource resource = Resource.newResource("jar:" + root.toURI() + "!"); + Resource resource = JarResource.newJarResource(Resource + .newResource(root)); handler.setBaseResource(resource); } else {