diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzer.java index 75f1b1c643a7..2ee3fa5ae6b8 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ private FailureAnalysis analyzeGenericBindException(BindException cause) { 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())); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzer.java index 5c2d76a3100a..7a8a89031f06 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzer.java @@ -75,7 +75,7 @@ private FailureAnalysis analyzeBindValidationException(ExceptionDetails details) 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)); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzer.java index fbbcf9253deb..56ee670a793d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ private FailureAnalysis analyzeUnboundConfigurationPropertiesException(BindExcep 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())); } } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java index 51bfb5155135..5d5f09d03230 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java @@ -100,7 +100,7 @@ void bindExceptionDueToMapConversionFailure() { } 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); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzerTests.java index ea90d675bac1..237b3e5c8f8a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzerTests.java @@ -91,7 +91,7 @@ void otherBindExceptionShouldReturnAnalysis() { } 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) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzerTests.java index 0ea6eeb56204..d963ebc58416 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ void bindExceptionDueToUnboundElements() { } 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); }