I ended up making a custom converter that I'm testing now.  One caveat to 
notice is to be sure that you understand the factory nature of the NumberFormat 
as I found its behavior a bit suprising:

$ jython.bat
Jython 2.2a1 on java1.5.0_06 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> from java.text import *
>>> decFmt = DecimalFormat.getInstance()
>>> decFmt
[EMAIL PROTECTED]
>>> intFmt = NumberFormat.getIntegerInstance()
>>> intFmt
[EMAIL PROTECTED]
>>> val = intFmt.parse('1')
>>> val
1L
>>> intFmt.setParseIntegerOnly(1)
>>> val = intFmt.parse('1')
>>> val
1L
>>>

Notice that the same DecimalFormat instance is returned for integer parsing.  
This is also the same instance returned in my JBoss application server running 
on the same box!  I think this is related to the JDK 1.5 startup optimizations 
as the same instance is returned even if the server is stopped and the jython 
JVM restarted.  In my case, the Long value returned was failing when being set 
on a JavaBean property of type Integer so I had to perform explicit Integer 
instantiation.

Hope that helps,

James




-----Original Message-----
From: Jeff Bischoff [mailto:[EMAIL PROTECTED]
Sent: Wed 5/31/2006 11:30 AM
To: MyFaces Discussion
Subject: Re: convertNumber
 
Thanks James,

How about a tomahawk converter, with the coercion back in place? (See 
the JIRA)

Sounds like we already have the code for it, so why not just move that 
extra functionality over to tomahawk?

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

James Richards wrote:
> I found discussion of this on the mailing list but I can't recall how I 
> located the thread [was via google search].  Here is the JIRA issue:
> 
> http://issues.apache.org/jira/browse/MYFACES-891
> 
> Basically, Sun Strikes Again...
> 
> Given the silence of the mailing list in response to my earlier query, I'm 
> assuming that implementing a custom converter is the way to go.  If you find 
> another alternative, I'm interested as I will probably have to change quite a 
> few files to fix this.
> 
> Thanks,
> 
> James
> 
> 
> -----Original Message-----
> From: Jeff Bischoff [mailto:[EMAIL PROTECTED]
> Sent: Fri 5/26/2006 1:14 PM
> To: MyFaces Discussion
> Subject: Re: convertNumber
>  
> I'm also curious about this. Is there information about this breakage 
> made available somewhere easily accessible?
> 
> James Richards wrote:
> 
>>I'm having a problem upgrading MyFaces due to our liberal use of the 
>>convertNumber tag.  After looking at the mailing list it's clear that 
>>the breakage is per-specification.  What is the recommended solution for 
>>number conversion?
>>
>>Thanks,
>>
>>James
>>
> 
> 
> 
> 



<<winmail.dat>>

Reply via email to