From 869ed4f71a667cf730a157e8aac422ca4efd48c8 Mon Sep 17 00:00:00 2001 From: TheoCaldas Date: Mon, 4 Jul 2022 22:16:05 -0300 Subject: [PATCH 1/2] Delimit output value in failure analysis See gh-31571 --- .../boot/diagnostics/analyzer/BindFailureAnalyzer.java | 2 +- .../diagnostics/analyzer/BindValidationFailureAnalyzer.java | 2 +- .../analyzer/UnboundConfigurationPropertyFailureAnalyzer.java | 2 +- .../boot/diagnostics/analyzer/BindFailureAnalyzerTests.java | 2 +- .../analyzer/BindValidationFailureAnalyzerTests.java | 2 +- .../UnboundConfigurationPropertyFailureAnalyzerTests.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) 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 75f1b1c643..72e5d71cc1 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 @@ -63,7 +63,7 @@ class BindFailureAnalyzer extends AbstractFailureAnalyzer { 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 7e925bc1ac..b11bc3df57 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 @@ class BindValidationFailureAnalyzer extends AbstractFailureAnalyzer { 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 fbbcf9253d..f574b17136 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 @@ -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())); } } 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 a1da2db773..c58c6f2fb4 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 @@ -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); } 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 d5a5714ea8..b281fe2c26 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 @@ -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) { 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 0ea6eeb562..fdaafaf97b 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 @@ -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); } From 4eb5037828d72caa5dbc2b823e24a6e3217f8013 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 18 Jul 2022 11:48:35 +0200 Subject: [PATCH 2/2] Update copyright year of changed files See gh-31571 --- .../boot/diagnostics/analyzer/BindFailureAnalyzer.java | 2 +- .../diagnostics/analyzer/BindValidationFailureAnalyzer.java | 2 +- .../analyzer/UnboundConfigurationPropertyFailureAnalyzer.java | 2 +- .../analyzer/BindValidationFailureAnalyzerTests.java | 2 +- .../UnboundConfigurationPropertyFailureAnalyzerTests.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) 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 72e5d71cc1..2ee3fa5ae6 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. 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 b11bc3df57..81ea033305 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 @@ -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. 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 f574b17136..56ee670a79 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. 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 b281fe2c26..faff7fce8a 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 @@ -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. 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 fdaafaf97b..d963ebc584 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.