[pylucene-dev] Bug/JCC: NumberTools.longToString

Pete pfein at pobox.com
Thu Nov 15 17:57:40 PST 2007


On Thursday November 15 2007 8:17:55 pm Pete wrote:
> On Thursday November 15 2007 7:49:52 pm Andi Vajda wrote:
> > Yes, that's the intent.
>
> Plain ints were accepted here by PyLucene-gcj.

This just bit me again.  This code, which worked in PyLucene-gcj, throws an 
exception in lucene-jcc:

DateTools.timeToString(int(value.strftime('%s')),
                                       DateTools.Resolution.SECOND)

timeToString is expecting a long (kindly ignore the off by 1000x bug).

This at least needs to be in the README.

> >    - it makes it ambiguous: if there were two java methods called
> >      longToString(), one taking a long and one taking an int, making the
> > long one accept int would cause the wrong method to be called if long is
> > checked before int.

What about when there's no such overloading? ie, when there's a single method 
taking a long, can JCC cast the ints to longs in that case?

Again, I'll deal if necessary, but I suspect this going to bite others as 
well.  Debugging would be easier if lucene.InvalidArgsError contained more 
info about which arg was invalid...

-- 
Peter Fein   ||   773-575-0694   ||   pfein at pobox.com
http://www.pobox.com/~pfein/   ||   PGP: 0xCCF6AE6B
irc: pfein at freenode.net   ||   jabber: peter.fein at gmail.com


More information about the pylucene-dev mailing list