[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug swing/25536] New: javax.swing.text.InternationalFormatter.stringToV
From: |
ctl at highsorcery dot com |
Subject: |
[Bug swing/25536] New: javax.swing.text.InternationalFormatter.stringToValue doesn't return the correct type |
Date: |
22 Dec 2005 18:41:27 -0000 |
NumberFormatter's stringToValue function, which is actually
InternationalFormatter'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 Double?
--
Summary: javax.swing.text.InternationalFormatter.stringToValue
doesn't return the correct type
Product: classpath
Version: 0.20
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: swing
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ctl at highsorcery dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25536
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug swing/25536] New: javax.swing.text.InternationalFormatter.stringToValue doesn't return the correct type,
ctl at highsorcery dot com <=