NPE on welcome page when 'spi-theme-default' doesn't exists #15476

closes #15476
This commit is contained in:
Pedro Hos 2023-03-26 19:43:41 -03:00 committed by Marek Posolda
parent 0fb9b9becd
commit aa9744246c

View file

@ -36,6 +36,8 @@ import org.keycloak.theme.freemarker.FreeMarkerProvider;
import org.keycloak.urls.UrlType;
import org.keycloak.utils.MediaType;
import io.quarkus.logging.Log;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@ -58,6 +60,7 @@ import java.net.URISyntaxException;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
/**
@ -161,6 +164,15 @@ public class QuarkusWelcomeResource {
try {
Theme theme = getTheme();
if(Objects.isNull(theme)) {
Log.error("Theme is null please check the \"--spi-theme-default\" parameter");
errorMessage = "The theme is null";
ResponseBuilder rb = Response.status(Status.BAD_REQUEST)
.entity(errorMessage)
.cacheControl(CacheControlUtil.noCache());
return rb.build();
}
Map<String, Object> map = new HashMap<>();
map.put("adminConsoleEnabled", isAdminConsoleEnabled());