-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Error in HQL numeric literal parsing
PostPosted: Mon Jan 23, 2006 5:40 am 
Newbie

Joined: Tue Mar 08, 2005 8:00 am
Posts: 10
This is about Hibernate 3.1.1, but I think this error predates that version.

In the HQL grammar definition (hql.g) the only element that differentiates a NUM_INT from a NUM_LONG is a 'l' after the number.

So 5, 6666, 777777777777 are all parsed as NUM_INT, and 777l is parsed as a NUM_LONG.
Unfortunately this behaviour is buggy: in LiteralProcessor.processNumeric the string is passed to Integer.parseInt or Long.parseLong.

Long.parseLong cannot interpret correctly a string terminated by l. From the Long.parseLong Java documentation:

"Note that neither the character L ('\u004C') nor l ('\u006C') is permitted to appear at the end of the string as a type indicator, as would be permitted in Java programming language source code."

This is the first bug. The second one is that a numeric string like "9999999999" generates a NumberFormatException, as it could not fit in an Integer.

I have to open a Jira ticket for both bugs, or there's something that I miss?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 5:58 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Please report to JIRA.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.