Skip to content

Commit febd346

Browse files
committed
Merge pull request #31571 from TheoCaldas
* pr/31571: Update copyright year of changed files Delimit output value in failure analysis Closes gh-31571
2 parents 3e3ea91 + 4eb5037 commit febd346

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -63,7 +63,7 @@ private FailureAnalysis analyzeGenericBindException(BindException cause) {
6363
private void buildDescription(StringBuilder description, ConfigurationProperty property) {
6464
if (property != null) {
6565
description.append(String.format("%n Property: %s", property.getName()));
66-
description.append(String.format("%n Value: %s", property.getValue()));
66+
description.append(String.format("%n Value: \"%s\"", property.getValue()));
6767
description.append(String.format("%n Origin: %s", property.getOrigin()));
6868
}
6969
}

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -75,7 +75,7 @@ private FailureAnalysis analyzeBindValidationException(ExceptionDetails details)
7575
private void appendFieldError(StringBuilder description, FieldError error) {
7676
Origin origin = Origin.from(error);
7777
description.append(String.format("%n Property: %s", error.getObjectName() + "." + error.getField()));
78-
description.append(String.format("%n Value: %s", error.getRejectedValue()));
78+
description.append(String.format("%n Value: \"%s\"", error.getRejectedValue()));
7979
if (origin != null) {
8080
description.append(String.format("%n Origin: %s", origin));
8181
}

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ private FailureAnalysis analyzeUnboundConfigurationPropertiesException(BindExcep
5151
private void buildDescription(StringBuilder description, ConfigurationProperty property) {
5252
if (property != null) {
5353
description.append(String.format("%n Property: %s", property.getName()));
54-
description.append(String.format("%n Value: %s", property.getValue()));
54+
description.append(String.format("%n Value: \"%s\"", property.getValue()));
5555
description.append(String.format("%n Origin: %s", property.getOrigin()));
5656
}
5757
}

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void bindExceptionDueToMapConversionFailure() {
101101
}
102102

103103
private static String failure(String property, String value, String origin, String reason) {
104-
return String.format("Property: %s%n Value: %s%n Origin: %s%n Reason: %s", property, value, origin,
104+
return String.format("Property: %s%n Value: \"%s\"%n Origin: %s%n Reason: %s", property, value, origin,
105105
reason);
106106
}
107107

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -92,7 +92,7 @@ void otherBindExceptionShouldReturnAnalysis() {
9292
}
9393

9494
private static String failure(String property, String value, String reason) {
95-
return String.format("Property: %s%n Value: %s%n Reason: %s", property, value, reason);
95+
return String.format("Property: %s%n Value: \"%s\"%n Reason: %s", property, value, reason);
9696
}
9797

9898
private FailureAnalysis performAnalysis(Class<?> configuration, String... environment) {

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -63,7 +63,7 @@ void bindExceptionDueToUnboundElements() {
6363
}
6464

6565
private static String failure(String property, String value, String origin, String reason) {
66-
return String.format("Property: %s%n Value: %s%n Origin: %s%n Reason: %s", property, value, origin,
66+
return String.format("Property: %s%n Value: \"%s\"%n Origin: %s%n Reason: %s", property, value, origin,
6767
reason);
6868
}
6969

0 commit comments

Comments
 (0)