Commit 586b52fa authored by Dave Syer's avatar Dave Syer

Fix Groovy template URLs

parent c8ca2495
...@@ -23,6 +23,8 @@ import groovy.text.markup.TemplateConfiguration; ...@@ -23,6 +23,8 @@ import groovy.text.markup.TemplateConfiguration;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.Servlet; import javax.servlet.Servlet;
...@@ -99,11 +101,14 @@ public class GroovyTemplateAutoConfiguration { ...@@ -99,11 +101,14 @@ public class GroovyTemplateAutoConfiguration {
Resource[] resources = this.resourceLoader.getResources(this.properties Resource[] resources = this.resourceLoader.getResources(this.properties
.getPrefix()); .getPrefix());
if (resources.length > 0) { if (resources.length > 0) {
URL[] urls = new URL[resources.length]; List<URL> urls = new ArrayList<URL>();
for (int i = 0; i < resources.length; i++) { for (Resource resource : resources) {
urls[i] = resources[i].getURL(); if (resource.exists()) {
urls.add(resource.getURL());
}
} }
return new URLClassLoader(urls, this.classLoader); return new URLClassLoader(urls.toArray(new URL[urls.size()]),
this.classLoader);
} }
else { else {
return this.classLoader; return this.classLoader;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment