Fixing build failure
This commit is contained in:
parent
ab4f02b2bd
commit
ed511565ae
|
@ -1,5 +1,6 @@
|
||||||
package ca.uhn.fhir.rest.server.interceptor;
|
package ca.uhn.fhir.rest.server.interceptor;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.util.ClasspathUtil;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -16,15 +17,21 @@ import java.util.Properties;
|
||||||
public class ConfigLoader {
|
public class ConfigLoader {
|
||||||
|
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(ConfigLoader.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(ConfigLoader.class);
|
||||||
|
public static final String CLASSPATH_PREFIX = "classpath:";
|
||||||
|
|
||||||
public static String loadResourceContent(String theResourcePath) {
|
public static String loadResourceContent(String theResourcePath) {
|
||||||
try {
|
if(theResourcePath.startsWith(CLASSPATH_PREFIX)) {
|
||||||
URL url = ResourceUtils.getURL(theResourcePath);
|
theResourcePath = theResourcePath.substring(CLASSPATH_PREFIX.length());
|
||||||
File file = ResourceUtils.getFile(url);
|
|
||||||
return IOUtils.toString(new FileReader(file));
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(String.format("Unable to load resource %s", theResourcePath), e);
|
|
||||||
}
|
}
|
||||||
|
return ClasspathUtil.loadResource(theResourcePath);
|
||||||
|
// FIXME the code below seems to be failing in the build server...
|
||||||
|
// try {
|
||||||
|
// URL url = ResourceUtils.getURL(theResourcePath);
|
||||||
|
// File file = ResourceUtils.getFile(url);
|
||||||
|
// return IOUtils.toString(new FileReader(file));
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// throw new RuntimeException(String.format("Unable to load resource %s", theResourcePath), e);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Properties loadProperties(String theResourcePath) {
|
public static Properties loadProperties(String theResourcePath) {
|
||||||
|
|
Loading…
Reference in New Issue