Thanks for the pointer John. Looks like its the NumberFormat class that 
is at fault.  e.g. -1 returns "1-" when NumberFormat.format() is called.

public class NumberFormatTest {

     public static void main(String[] args) {
         Locale locale = new Locale("ar", "AE");
         NumberFormat format = NumberFormat.getNumberInstance(locale);

         String f = format.format(-1);
         System.out.println("Format: " + f);
     }
}


I will log a bug against the JDK.

Newman, John W wrote:
> Stripes simply uses NumberFormat under the hood, that is where this behavior 
> is coming from.  So it's either a jdk bug or not a bug at all.  See 
> http://stripes.svn.sourceforge.net/viewvc/stripes/trunk/stripes/src/net/sourceforge/stripes/validation/NumberTypeConverterSupport.java?revision=783&view=markup
> 
> 
> Also "faield" is spelled wrong there. 
> 
> 
> public class NumberFormatTest  {
> 
>       public static void main(String[] args) {
>               Locale locale = new Locale("ar", "AE");
>               NumberFormat format = NumberFormat.getInstance(locale);
> 
>               convert(locale, format, "-1");
>               convert(locale, format, "1-");
>       }
> 
>       private static void convert(Locale locale, NumberFormat format, String 
> input) {
>               ParsePosition pp = new ParsePosition(0);
>               pp.setIndex(0);
> 
>               Number number = format.parse(input, pp);
>               if (number != null && input.length() == pp.getIndex()) {
>                       System.out.println("Successfully converted " + input + 
> " to "
>                                       + number);
>               } else {
>                       System.out.println("Failed to convert " + input + " 
> using locale "
>                                       + locale);
>               }
>       }
> }
> 
> 
> -----Original Message-----
> From: Martin Walsh [mailto:martin.wa...@sun.com] 
> Sent: Wednesday, July 08, 2009 7:49 AM
> To: stripes-users@lists.sourceforge.net
> Subject: [Stripes-users] RTL support for Integer Type Converter
> 
> It seems as though there is a bug in the Stripes IntegerTypeConverter 
> when it is used with right to left languages.  When a negative value is 
> supplied, stripes fails validation.
> 
> I believe the problem is that the converter expects "1-" for RTL 
> languages, when in fact it should be expecting "-1". This is because in 
> RTL languages, numbers are still written the same as in LTR languages.
> 
> Could someone confirm this.
> 
> Here is a list of the failing locales:
> 
> Faield to convert -1 using locale ar_AE
> Faield to convert -1 using locale ar_IQ
> Faield to convert -1 using locale ar_YE
> Faield to convert -1 using locale ar_QA
> Faield to convert -1 using locale mk_MK
> Faield to convert -1 using locale ar_SA
> Faield to convert -1 using locale ar_LB
> Faield to convert -1 using locale ar_KW
> Faield to convert -1 using locale ar_SD
> Faield to convert -1 using locale ar_SY
> Faield to convert -1 using locale ar_BH
> Faield to convert -1 using locale ar_TN
> Faield to convert -1 using locale ar_JO
> Faield to convert -1 using locale ar_EG
> Faield to convert -1 using locale ar_MA
> Faield to convert -1 using locale ar_DZ
> Faield to convert -1 using locale ar_LY
> Faield to convert -1 using locale ar
> Faield to convert -1 using locale ar_OM
> 
> 
> Thanks,
> 
> Martin.
> 
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge  
> This is your chance to win up to $100,000 in prizes! For a limited time, 
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize  
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
> 
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge  
> This is your chance to win up to $100,000 in prizes! For a limited time, 
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize  
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to