From c56e171f3adee0ccc14dfa76e79dd1065fa95d03 Mon Sep 17 00:00:00 2001 From: stianst Date: Wed, 5 Sep 2018 06:56:29 +0200 Subject: [PATCH] KEYCLOAK-7608 Check if themes dir is null in FolderThemeProvider --- .../java/org/keycloak/theme/FolderThemeProvider.java | 10 +++++++++- .../org/keycloak/theme/FolderThemeProviderFactory.java | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/services/src/main/java/org/keycloak/theme/FolderThemeProvider.java b/services/src/main/java/org/keycloak/theme/FolderThemeProvider.java index 43f578b66b..5c75f56f2b 100755 --- a/services/src/main/java/org/keycloak/theme/FolderThemeProvider.java +++ b/services/src/main/java/org/keycloak/theme/FolderThemeProvider.java @@ -42,12 +42,20 @@ public class FolderThemeProvider implements ThemeProvider { @Override public Theme getTheme(String name, Theme.Type type) throws IOException { + if (themesDir == null) { + return null; + } + File themeDir = getThemeDir(name, type); return themeDir.isDirectory() ? new FolderTheme(themeDir, name, type) : null; } @Override public Set nameSet(Theme.Type type) { + if (themesDir == null) { + return Collections.emptySet(); + } + final String typeName = type.name().toLowerCase(); File[] themeDirs = themesDir.listFiles(new FileFilter() { @Override @@ -68,7 +76,7 @@ public class FolderThemeProvider implements ThemeProvider { @Override public boolean hasTheme(String name, Theme.Type type) { - return getThemeDir(name, type).isDirectory(); + return themesDir != null ? getThemeDir(name, type).isDirectory() : false; } @Override diff --git a/services/src/main/java/org/keycloak/theme/FolderThemeProviderFactory.java b/services/src/main/java/org/keycloak/theme/FolderThemeProviderFactory.java index 694891ddeb..38ae742a08 100755 --- a/services/src/main/java/org/keycloak/theme/FolderThemeProviderFactory.java +++ b/services/src/main/java/org/keycloak/theme/FolderThemeProviderFactory.java @@ -59,4 +59,5 @@ public class FolderThemeProviderFactory implements ThemeProviderFactory { public String getId() { return "folder"; } + }