Fixed: Fix some bugs Spotbugs reports
Incorrect lazy initialisation
Thanks: Spotbugs
@@ -44,7 +44,7 @@ public final class UtilHtml {
private static final String MODULE = UtilHtml.class.getName();
private static final Parser JSOUP_HTML_PARSER = createJSoupHtmlParser();
private static final String[] TAG_SHOULD_CLOSE_LIST = new String[]{"div"};
- private static List<String> visualThemeBasePathsName;
+ private static List<String> visualThemeBasePathsName = new ArrayList<>();
private UtilHtml() { }
private static Parser createJSoupHtmlParser() {
@@ -117,10 +117,8 @@ public final class UtilHtml {
}
public static List<String> getVisualThemeFolderNamesToExempt() {
- if (visualThemeBasePathsName == null) {
try {
List<File> xmlThemes = ThemeFactory.getThemeXmlFiles();
- visualThemeBasePathsName = new ArrayList<>();
String themePathKey = "/themes/";
String pluginPathKey = "/plugins/";
for (File xmlTheme : xmlThemes) {
@@ -140,7 +138,6 @@ public final class UtilHtml {
} catch (IOException e) {
Debug.logError(e, MODULE);
}
- }
return Collections.unmodifiableList(visualThemeBasePathsName);
}
