Hi Chris, Thanks for your explanations. Could you file a bugreport about this and assign it to me (roman at kennke dot org), so it doesn't get lost? Right now I don't have much time and I'll try to look at this in a few days.
Cheers, Roman Am Donnerstag, den 22.12.2005, 12:34 -0500 schrieb Chris Lansdown: > Hi, > > NumberFormatter's stringToValue function currently checks to see if the > valueClass is not null, and if so, converts its value to that. > > The problem is that valueClass gets set in > java.swing.text.DefaultFormatter's constructor sets valueClass to be > Object.class, so the lines: > > if (valueClass != null) > o = super.stringToValue(o.toString()); > > have the effect of always setting the returned value to a String, even > though NumberFormatter properly converts the thing to a number first. > > Two alternative fixes would be to get rid of the always setting valueClass > in DefaultFormatter's constructor (I have no idea what the implications of > this are), and changing the condition to: > > if(valueClass != null && valueClass != Object.class) > etc. > > Since there's no sense in trying to cast something up to an object anyhow. > > Alternatively, maybe the constructor of NumberFormat should set the > valueClass to Number? > > Thanks, > Chris Lansdown >
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
_______________________________________________ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath