This commit is contained in:
gtully 2013-09-03 00:36:49 +01:00
parent 3222767e79
commit 9f26e0b640
1 changed files with 8 additions and 1 deletions

View File

@ -17,6 +17,7 @@
package org.apache.activemq.spring; package org.apache.activemq.spring;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.FileSystemResource;
@ -32,7 +33,13 @@ public class Utils {
if (file.exists()) { if (file.exists()) {
resource = new FileSystemResource(uri); resource = new FileSystemResource(uri);
} else if (ResourceUtils.isUrl(uri)) { } else if (ResourceUtils.isUrl(uri)) {
resource = new UrlResource(uri); try {
resource = new UrlResource(ResourceUtils.getURL(uri));
} catch (FileNotFoundException e) {
MalformedURLException malformedURLException = new MalformedURLException(uri);
malformedURLException.initCause(e);
throw malformedURLException;
}
} else { } else {
resource = new ClassPathResource(uri); resource = new ClassPathResource(uri);
} }