New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detection of DurationStyle.ISO8601 does not support lower-case input #32218
Comments
Not sure it is a bug. From the ISO-8601 spec (emphasize is mine)
It explicitly mentions capital letters. So one could argue that Spring (Boot) might adhere to strictly to the standard as opposed the |
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. |
Thanks for the feedback! Add a lower-case P in the current simpler pattern may be enough - update |
PR created at #32223 to fix this bug - please have a review. |
Closing in favor of PR #32223. Thanks @valentine-dev! |
Bug Report
Environment
Version of Spring Boot
2.7.3
Version of Java
11
Expected (what is in the Reference Documentation)
from https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties.conversion.durations
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
Pattern.CASE_INSENSITIVE
as the second argument to thePattern.compile
method at Line 87 of DurationStyle.java"([-+]?)P(?:([-+]?[0-9]+)D)?" +
"(T(?:([-+]?[0-9]+)H)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)(?:[.,]([0-9]{0,9}))?S)?)?"
The text was updated successfully, but these errors were encountered: