Fix Groovy template URLs

pull/890/head
Dave Syer 11 years ago
parent c8ca2495de
commit 586b52faf5

@ -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 {
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;

Loading…
Cancel
Save