synchronized (themeProps) {
Properties props = (Properties) themeProps.get(template.getTheme());
if (props == null) {
String propName = template.getDir() + "/" + template.getTheme() + "/"+getThemePropertiesFileName();
// WW-1292
// let's try getting it from the filesystem
File propFile = new File(propName);
InputStream is = null;
try {
if (propFile.exists()) {
is = new FileInputStream(propFile);
}
}
catch(FileNotFoundException e) {
LOG.warn("Unable to find file in filesystem ["+propFile.getAbsolutePath()+"]");
}
if (is == null) {
// if its not in filesystem. let's try the classpath
is = ClassLoaderUtil.getResourceAsStream(propName, getClass());
}
props = new Properties();
if (is != null) {
try {
props.load(is);
} catch (IOException e) {
LOG.error("Could not load " + propName, e);
}
}
themeProps.put(template.getTheme(), props);
}
return props;
}