mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Delimit output value in failure analysis
See gh-31571
This commit is contained in:
parent
3e3ea914bb
commit
869ed4f71a
@ -63,7 +63,7 @@ class BindFailureAnalyzer extends AbstractFailureAnalyzer<BindException> {
|
||||
private void buildDescription(StringBuilder description, ConfigurationProperty property) {
|
||||
if (property != null) {
|
||||
description.append(String.format("%n Property: %s", property.getName()));
|
||||
description.append(String.format("%n Value: %s", property.getValue()));
|
||||
description.append(String.format("%n Value: \"%s\"", property.getValue()));
|
||||
description.append(String.format("%n Origin: %s", property.getOrigin()));
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class BindValidationFailureAnalyzer extends AbstractFailureAnalyzer<Throwable> {
|
||||
private void appendFieldError(StringBuilder description, FieldError error) {
|
||||
Origin origin = Origin.from(error);
|
||||
description.append(String.format("%n Property: %s", error.getObjectName() + "." + error.getField()));
|
||||
description.append(String.format("%n Value: %s", error.getRejectedValue()));
|
||||
description.append(String.format("%n Value: \"%s\"", error.getRejectedValue()));
|
||||
if (origin != null) {
|
||||
description.append(String.format("%n Origin: %s", origin));
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class UnboundConfigurationPropertyFailureAnalyzer
|
||||
private void buildDescription(StringBuilder description, ConfigurationProperty property) {
|
||||
if (property != null) {
|
||||
description.append(String.format("%n Property: %s", property.getName()));
|
||||
description.append(String.format("%n Value: %s", property.getValue()));
|
||||
description.append(String.format("%n Value: \"%s\"", property.getValue()));
|
||||
description.append(String.format("%n Origin: %s", property.getOrigin()));
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ class BindFailureAnalyzerTests {
|
||||
}
|
||||
|
||||
private static String failure(String property, String value, String origin, String reason) {
|
||||
return String.format("Property: %s%n Value: %s%n Origin: %s%n Reason: %s", property, value, origin,
|
||||
return String.format("Property: %s%n Value: \"%s\"%n Origin: %s%n Reason: %s", property, value, origin,
|
||||
reason);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ class BindValidationFailureAnalyzerTests {
|
||||
}
|
||||
|
||||
private static String failure(String property, String value, String reason) {
|
||||
return String.format("Property: %s%n Value: %s%n Reason: %s", property, value, reason);
|
||||
return String.format("Property: %s%n Value: \"%s\"%n Reason: %s", property, value, reason);
|
||||
}
|
||||
|
||||
private FailureAnalysis performAnalysis(Class<?> configuration, String... environment) {
|
||||
|
@ -63,7 +63,7 @@ class UnboundConfigurationPropertyFailureAnalyzerTests {
|
||||
}
|
||||
|
||||
private static String failure(String property, String value, String origin, String reason) {
|
||||
return String.format("Property: %s%n Value: %s%n Origin: %s%n Reason: %s", property, value, origin,
|
||||
return String.format("Property: %s%n Value: \"%s\"%n Origin: %s%n Reason: %s", property, value, origin,
|
||||
reason);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user