This commit is contained in:
Phillip Webb
2020-04-17 16:12:11 -07:00
parent 555132e096
commit e3b8478621
5 changed files with 36 additions and 39 deletions

View File

@@ -156,14 +156,14 @@ public class DefaultErrorWebExceptionHandler extends AbstractErrorWebExceptionHa
* @return if the stacktrace attribute should be included
*/
protected boolean isIncludeStackTrace(ServerRequest request, MediaType produces) {
ErrorProperties.IncludeStacktrace include = this.errorProperties.getIncludeStacktrace();
if (include == ErrorProperties.IncludeStacktrace.ALWAYS) {
switch (this.errorProperties.getIncludeStacktrace()) {
case ALWAYS:
return true;
}
if (include == ErrorProperties.IncludeStacktrace.ON_TRACE_PARAM) {
case ON_TRACE_PARAM:
return isTraceEnabled(request);
default:
return false;
}
return false;
}
/**
@@ -173,14 +173,14 @@ public class DefaultErrorWebExceptionHandler extends AbstractErrorWebExceptionHa
* @return if the message and errors attributes should be included
*/
protected boolean isIncludeDetails(ServerRequest request, MediaType produces) {
ErrorProperties.IncludeDetails include = this.errorProperties.getIncludeDetails();
if (include == ErrorProperties.IncludeDetails.ALWAYS) {
switch (this.errorProperties.getIncludeDetails()) {
case ALWAYS:
return true;
}
if (include == ErrorProperties.IncludeDetails.ON_DETAILS_PARAM) {
case ON_DETAILS_PARAM:
return isDetailsEnabled(request);
default:
return false;
}
return false;
}
/**

View File

@@ -24,8 +24,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.boot.autoconfigure.web.ErrorProperties;
import org.springframework.boot.autoconfigure.web.ErrorProperties.IncludeDetails;
import org.springframework.boot.autoconfigure.web.ErrorProperties.IncludeStacktrace;
import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory;
import org.springframework.http.HttpStatus;
@@ -120,14 +118,14 @@ public class BasicErrorController extends AbstractErrorController {
* @return if the stacktrace attribute should be included
*/
protected boolean isIncludeStackTrace(HttpServletRequest request, MediaType produces) {
IncludeStacktrace include = getErrorProperties().getIncludeStacktrace();
if (include == IncludeStacktrace.ALWAYS) {
switch (getErrorProperties().getIncludeStacktrace()) {
case ALWAYS:
return true;
}
if (include == IncludeStacktrace.ON_TRACE_PARAM) {
case ON_TRACE_PARAM:
return getTraceParameter(request);
default:
return false;
}
return false;
}
/**
@@ -137,14 +135,14 @@ public class BasicErrorController extends AbstractErrorController {
* @return if the error details attributes should be included
*/
protected boolean isIncludeDetails(HttpServletRequest request, MediaType produces) {
IncludeDetails include = getErrorProperties().getIncludeDetails();
if (include == IncludeDetails.ALWAYS) {
switch (getErrorProperties().getIncludeDetails()) {
case ALWAYS:
return true;
}
if (include == IncludeDetails.ON_DETAILS_PARAM) {
case ON_DETAILS_PARAM:
return getDetailsParameter(request);
default:
return false;
}
return false;
}
/**