[hibernate-issues] [Hibernate-JIRA] Created: (HV-376) validateValue() and validateProperty() are too restrictive regarding processable property names

Gunnar Morling (JIRA) noreply at atlassian.com
Fri Sep 24 06:33:57 EDT 2010


validateValue() and validateProperty() are too restrictive regarding processable property names
-----------------------------------------------------------------------------------------------

                 Key: HV-376
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-376
             Project: Hibernate Validator
          Issue Type: Bug
          Components: engine
    Affects Versions: 4.1.0.Final
            Reporter: Gunnar Morling
            Assignee: Hardy Ferentschik
            Priority: Minor


The methods Validator#validateValue() and Validator#validateProperty() expect the name of a bean property, for which constraint validation should be performed.

Currently not all valid Java property (field/method) identifiers are supported here, as the specified property name is processed in PathImpl with a regular expression, that matches only the word character class (A-Za-z0-9_), causing the evaluation of uncommon but yet valid property names such as the following ones to fail:

* private String höchstBetrag; // German Umlaute such as "ö" are allowed in Java identifiers
* private String €Amount;  // some currency signs such as "€" are allowed, sigh
* private String höchst\u00f6Betrag; // specifying letters such as "ö" using Unicode is allowed

Trying to do so results in the following exception:

{code:java} 
java.lang.IllegalArgumentException: Unable to parse property path ö
at org.hibernate.validator.engine.PathImpl.parseProperty(PathImpl.java:216)
at org.hibernate.validator.engine.PathImpl.createPathFromString(PathImpl.java:64)
at org.hibernate.validator.engine.ValidatorImpl.validateValue(ValidatorImpl.java:152)
{code} 
More information on the identifiers allowed in the Java language can be found in [JLS, chapter 3.8|http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.8].

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list