When I run the test i18n/I18NImportExport.java with JSR169 using IBM's
J2ME/CDC/Foundation Profile, I get the following exception:
"JAVA ERROR: java.lang.NoSuchMethodError:
java/sql/ResultSet.getBigDecimal(II)Ljava/math/BigDecimal;"

In the test, LOCALIZEDDISPLAY is on and the table has a DECIMAL
column. This causes the exception. On looking at the code, following
is done to format DECIMAL types in LocalizedResource:

      if (type == Types.NUMERIC || type == Types.DECIMAL) {
                return  getNumberAsString(rs.getBigDecimal(columnNumber,
rsm.getScale(columnNumber)));
        }

where getNumberAsString method does the following:
        
      public String getNumberAsString(Object o){
                if (enableLocalized){
                        return formatNumber.format(o, new StringBuffer(), new
FieldPosition(0)).toString();
                }
                else {
                        return o.toString();
                }
        }


I have couple of questions on this:

1. Currently for NUMERIC/DECIMAL types, a BigDecimal object is passed
to "getNumberAsString". Since BigDecimal is not in J2ME/FP, can any
other object type be used to get an equivalent localized string?

2. Another solution to the problem is to format NUMERIC/DECIMAL types
only if BigDecimal class is available in the JVM. Otherwise, use
ResultSet getString method. But this would mean that these types will
not be localized in J2ME/FP. Is this acceptable?

Thanks,
Deepa

Reply via email to