Skip to content

Commit 92f0c5a

Browse files
authored
No copy-pasta.
1 parent 88803df commit 92f0c5a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/main/java/org/apache/commons/cli/Converter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,13 @@ public interface Converter<T, E extends Exception> {
7878
* Converts a String to a {@link Date} using the format string Form "EEE MMM dd HH:mm:ss zzz yyyy".
7979
*/
8080
Converter<Date, java.text.ParseException> DATE = s -> {
81+
final String pattern = "EEE MMM dd HH:mm:ss zzz yyyy";
8182
try {
82-
return new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy").parse(s);
83+
return new SimpleDateFormat(pattern).parse(s);
8384
} catch (final java.text.ParseException e) {
8485
// Date.toString() always emits English month/day names, so fall back to Locale.ENGLISH
8586
// when the default locale rejects the documented format.
86-
return new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH).parse(s);
87+
return new SimpleDateFormat(pattern, Locale.ENGLISH).parse(s);
8788
}
8889
};
8990

0 commit comments

Comments
 (0)