KEYCLOAK-7608 Check if themes dir is null in FolderThemeProvider
This commit is contained in:
parent
812e76c39b
commit
c56e171f3a
2 changed files with 10 additions and 1 deletions
|
@ -42,12 +42,20 @@ public class FolderThemeProvider implements ThemeProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Theme getTheme(String name, Theme.Type type) throws IOException {
|
public Theme getTheme(String name, Theme.Type type) throws IOException {
|
||||||
|
if (themesDir == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
File themeDir = getThemeDir(name, type);
|
File themeDir = getThemeDir(name, type);
|
||||||
return themeDir.isDirectory() ? new FolderTheme(themeDir, name, type) : null;
|
return themeDir.isDirectory() ? new FolderTheme(themeDir, name, type) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> nameSet(Theme.Type type) {
|
public Set<String> nameSet(Theme.Type type) {
|
||||||
|
if (themesDir == null) {
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
|
||||||
final String typeName = type.name().toLowerCase();
|
final String typeName = type.name().toLowerCase();
|
||||||
File[] themeDirs = themesDir.listFiles(new FileFilter() {
|
File[] themeDirs = themesDir.listFiles(new FileFilter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -68,7 +76,7 @@ public class FolderThemeProvider implements ThemeProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasTheme(String name, Theme.Type type) {
|
public boolean hasTheme(String name, Theme.Type type) {
|
||||||
return getThemeDir(name, type).isDirectory();
|
return themesDir != null ? getThemeDir(name, type).isDirectory() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -59,4 +59,5 @@ public class FolderThemeProviderFactory implements ThemeProviderFactory {
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return "folder";
|
return "folder";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue