Miscellaneous minor refactoring

This commit is contained in:
ryounes 2011-06-24 19:27:54 +00:00
parent 76fc86abc4
commit 95679dbed7
3 changed files with 13 additions and 8 deletions

View file

@ -54,18 +54,24 @@ public class FreemarkerConfigurationLoader {
} }
} }
public Configuration getConfig(VitroRequest vreq) { public Configuration getConfig(VitroRequest vreq) {
String themeDir = getThemeDir(vreq.getAppBean()); String themeDir = getThemeDir(vreq.getAppBean());
return getConfigForTheme(themeDir); return getConfigForTheme(themeDir);
} }
protected String getThemeDir(ApplicationBean appBean) { protected String getThemeDir(ApplicationBean appBean) {
String themeDir = null;
if (appBean == null) { if (appBean == null) {
log.error("Cannot get themeDir from null application bean"); log.error("Cannot get themeDir from null application bean");
} else if (appBean.getThemeDir() == null) { return null;
log.error("themeDir is null"); } else {
} themeDir = appBean.getThemeDir();
return appBean.getThemeDir().replaceAll("/$", ""); if (themeDir == null) {
log.error("themeDir is null");
return null;
}
}
return themeDir.replaceAll("/$", "");
} }

View file

@ -119,8 +119,7 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
* the subclass method. For the same reason, it can't refer to a static or instance field * the subclass method. For the same reason, it can't refer to a static or instance field
* REQUIRED_ACTIONS which is overridden in the subclass. * REQUIRED_ACTIONS which is overridden in the subclass.
*/ */
@SuppressWarnings("unused") protected Actions requiredActions(VitroRequest vreq) {
protected Actions requiredActions(VitroRequest vreq) {
return Actions.AUTHORIZED; return Actions.AUTHORIZED;
} }

View file

@ -34,7 +34,7 @@ public class ThemeUtils {
} }
// File.list() does not guarantee a specific order, so sort alphabetically // File.list() does not guarantee a specific order, so sort alphabetically
if (doSort == true) { if (doSort) {
Collections.sort(themeNames); Collections.sort(themeNames);
} }