From 4ea40a451a01bacaf6e5c96ddc5ea68a3ad66eae Mon Sep 17 00:00:00 2001 From: OrangeDog <675056+OrangeDog@users.noreply.github.com> Date: Tue, 26 May 2020 14:35:08 +0100 Subject: [PATCH 1/2] JavaDoc fix in converters. These throw IllegalArgumentException, not IllegalStateException. --- .../org/springframework/boot/convert/DurationStyle.java | 6 +++--- .../java/org/springframework/boot/convert/PeriodStyle.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationStyle.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationStyle.java index 631fae85a4aa..63ff1704ec39 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationStyle.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationStyle.java @@ -134,7 +134,7 @@ public String print(Duration value) { * Detect the style then parse the value to return a duration. * @param value the value to parse * @return the parsed duration - * @throws IllegalStateException if the value is not a known style or cannot be parsed + * @throws IllegalArgumentException if the value is not a known style or cannot be parsed */ public static Duration detectAndParse(String value) { return detectAndParse(value, null); @@ -146,7 +146,7 @@ public static Duration detectAndParse(String value) { * @param unit the duration unit to use if the value doesn't specify one ({@code null} * will default to ms) * @return the parsed duration - * @throws IllegalStateException if the value is not a known style or cannot be parsed + * @throws IllegalArgumentException if the value is not a known style or cannot be parsed */ public static Duration detectAndParse(String value, ChronoUnit unit) { return detect(value).parse(value, unit); @@ -156,7 +156,7 @@ public static Duration detectAndParse(String value, ChronoUnit unit) { * Detect the style from the given source value. * @param value the source value * @return the duration style - * @throws IllegalStateException if the value is not a known style + * @throws IllegalArgumentException if the value is not a known style */ public static DurationStyle detect(String value) { Assert.notNull(value, "Value must not be null"); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/PeriodStyle.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/PeriodStyle.java index 5ea887b95eea..228fdf28eb7c 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/PeriodStyle.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/PeriodStyle.java @@ -176,7 +176,7 @@ public String print(Period value) { * Detect the style then parse the value to return a period. * @param value the value to parse * @return the parsed period - * @throws IllegalStateException if the value is not a known style or cannot be parsed + * @throws IllegalArgumentException if the value is not a known style or cannot be parsed */ public static Period detectAndParse(String value) { return detectAndParse(value, null); @@ -188,7 +188,7 @@ public static Period detectAndParse(String value) { * @param unit the period unit to use if the value doesn't specify one ({@code null} * will default to ms) * @return the parsed period - * @throws IllegalStateException if the value is not a known style or cannot be parsed + * @throws IllegalArgumentException if the value is not a known style or cannot be parsed */ public static Period detectAndParse(String value, ChronoUnit unit) { return detect(value).parse(value, unit); @@ -198,7 +198,7 @@ public static Period detectAndParse(String value, ChronoUnit unit) { * Detect the style from the given source value. * @param value the source value * @return the period style - * @throws IllegalStateException if the value is not a known style + * @throws IllegalArgumentException if the value is not a known style */ public static PeriodStyle detect(String value) { Assert.notNull(value, "Value must not be null"); From 58bc2c2f36bb96691de0118ae84994443409594a Mon Sep 17 00:00:00 2001 From: OrangeDog <675056+OrangeDog@users.noreply.github.com> Date: Tue, 26 May 2020 14:40:26 +0100 Subject: [PATCH 2/2] Make Period JavaDoc consistent with Duration. --- .../springframework/boot/convert/PeriodToStringConverter.java | 3 ++- .../springframework/boot/convert/StringToPeriodConverter.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/PeriodToStringConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/PeriodToStringConverter.java index c157c05cd725..2cc840b78c42 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/PeriodToStringConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/PeriodToStringConverter.java @@ -32,7 +32,8 @@ * @author Eddú Meléndez * @author Edson Chávez * @since 2.3.0 - * @see Period + * @see PeriodFormat + * @see PeriodUnit */ public class PeriodToStringConverter implements GenericConverter { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToPeriodConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToPeriodConverter.java index e15bfd294680..d16e133af1f2 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToPeriodConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToPeriodConverter.java @@ -33,6 +33,7 @@ * @author Eddú Meléndez * @author Edson Chávez * @since 2.3.0 + * @see PeriodFormat * @see PeriodUnit */ public class StringToPeriodConverter implements GenericConverter {