[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-5085) Literals with leading zero in HQL validated as octal but used as decimal

James Livingston (JIRA) noreply at atlassian.com
Wed Apr 7 20:43:42 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5085?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Livingston updated HHH-5085:
----------------------------------

    Attachment: hqlnumerictest.tar.bz2

Test that can be run with "mvn test".

* If it should handle octal then testDecimal() should fail because 100 != 0100, or
* If it shouldn't handle octal, then testOctal() should pass because 0108 would be valid.


I can make a proper test for the testsuite if you want, once I know which way around it should actually behave.

> Literals with leading zero in HQL validated as octal but used as decimal
> ------------------------------------------------------------------------
>
>                 Key: HHH-5085
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5085
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: query-hql
>    Affects Versions: 3.3.2
>            Reporter: James Livingston
>            Priority: Minor
>         Attachments: hqlnumerictest.tar.bz2
>
>
> The grammar used to parse HQL/JPAQL treats numeric literals[0] with a leading 0 as octal (and 0x as hexadecimal), however those values are always converted[1] as base 10. This means that a literal 0100 will match a value of decimal one hundred, but a literal of 0108 will fail to validate due to the '8' character.
> Either the grammar should not handle octal/hexadecimal, or the conversation should process them correctly.
> [0] Starting at line 831 of core/src/main/antlr/hql.g in the 3.3.2 source
> [1] LiteralProcessor.determineIntegerRepresentation()

-- 
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