Detection of DurationStyle.ISO8601 does not support lower-case input
See original GitHub issueBug Report
Environment
Version of Spring Boot
2.7.3
Version of Java
11
Expected (what is in the Reference Documentation)
The standard ISO-8601 format used by java.time.Duration
Actual Behavior
Some format used by java.time.Duration is not working in Spring Boot app, like “pt25.234s” demonstrated in the example application at https://github.com/valentine-dev/spring-boot-duration-style-iso8601
Suggestion Solution
- Add
Pattern.CASE_INSENSITIVEas the second argument to thePattern.compilemethod at Line 87 of DurationStyle.java - Use the following pattern string in java.time.Duration source code (Line 151 ~ 152 in the file from JDK 11) at Line 65 of DurationStyle.java:
"([-+]?)P(?:([-+]?[0-9]+)D)?" +
"(T(?:([-+]?[0-9]+)H)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)(?:[.,]([0-9]{0,9}))?S)?)?"
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Detection of DurationStyle.ISO8601 does not support ... - GitHub
Detection of DurationStyle.ISO8601 does not support lower-case input #32232. wilkinsona opened this issue on Sep 5 · 0 comments.
Read more >"T" and "Z" case sensitive in ISO8601 format? - Stack Overflow
The letter 'T'. Parsing is case insensitive. So this allows upper case T and lower case t . We should not trust Java...
Read more >gt.pdf - R Project
Description Build display tables from tabular data with an easy-to-use set of functions. With its progressive approach, we can construct display ...
Read more >Free Automated Malware Analysis Service - Hybrid Analysis
Submit malware for free analysis with Falcon Sandbox and Hybrid Analysis technology. Hybrid Analysis develops and licenses analysis tools to ...
Read more >Boost.Chrono 2.0.2
Nevertheless round will exactly (with no round off error) detect a tie and ... If the author in the example does not want...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Given that we say we use the format that is used by java.time.Duration, I think it’s reasonable to expect the detect and detectAndParse methods to align with Duration’s own parsing.
I’m not sure that we need to go as far as using the same pattern as Duration does. Our simpler pattern used case-insensitively may be enough for our detection needs.
Closing in favor of PR #32223. Thanks @valentine-dev!