keycloak-aplcache

Merge pull request #1897 from mstruk/npe KEYCLOAK-2039

11/30/2015 8:44:56 AM

Details

diff --git a/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java b/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java
index 125b6ee..c26e60c 100755
--- a/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java
+++ b/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java
@@ -141,8 +141,10 @@ public class KeycloakApplication extends Application {
 
             if (node == null) {
                 URL resource = Thread.currentThread().getContextClassLoader().getResource("META-INF/keycloak-server.json");
-                log.info("Load config from " + resource);
-                node = new ObjectMapper().readTree(resource);
+                if (resource != null) {
+                    log.info("Load config from " + resource);
+                    node = new ObjectMapper().readTree(resource);
+                }
             }
 
             if (node != null) {
@@ -150,7 +152,7 @@ public class KeycloakApplication extends Application {
                 Config.init(new JsonConfigProvider(node, properties));
                 return;
             } else {
-                log.warn("Config 'keycloak-server.json' not found");
+                throw new RuntimeException("Config 'keycloak-server.json' not found");
             }
         } catch (IOException e) {
             throw new RuntimeException("Failed to load config", e);