Laurent Martelli (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate Validator (
https://hibernate.atlassian.net/browse/HV?atlOrigin=eyJpIjoiZmYyZWJmNmVhN...
) / Bug (
https://hibernate.atlassian.net/browse/HV-1955?atlOrigin=eyJpIjoiZmYyZWJm...
) HV-1955 (
https://hibernate.atlassian.net/browse/HV-1955?atlOrigin=eyJpIjoiZmYyZWJm...
) NotBlankValidator is not consistent with Jakarta @NotBlank specs (
https://hibernate.atlassian.net/browse/HV-1955?atlOrigin=eyJpIjoiZmYyZWJm...
)
Issue Type: Bug Affects Versions: 8.0.0.Final Assignee: Unassigned Components: validators
Created: 16/Jun/2023 03:30 AM Priority: Major Reporter: Laurent Martelli (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
The documentation for @NotBlank says “The annotated element must not be null and must
contain at least one non-whitespace character. Accepts CharSequence.” and refers to
Character.isWhitespace(char).
But NotBlankValidator uses trim() whose definition of a “space character” is different
from Character.isWhitespace(char).
String.isBlank() (introduced in Java 11) would be a better implementation choice. If
pre-Java 11 compatibility is required, Character.isWhitespace(char) could be be used.
(
https://hibernate.atlassian.net/browse/HV-1955#add-comment?atlOrigin=eyJp...
) Add Comment (
https://hibernate.atlassian.net/browse/HV-1955#add-comment?atlOrigin=eyJp...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100227- sha1:5147d46 )