Issue Details (XML | Word | Printable)

Key: DERBY-470
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Deepa Remesh
Reporter: Deepa Remesh
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Exception when using LOCALIZEDDISPLAY with JSR169

Created: 26/Jul/05 03:55 AM   Updated: 30/Sep/05 02:25 AM
Return to search
Component/s: Localization
Affects Version/s: None
Fix Version/s: 10.1.2.1, 10.2.1.6

Time Tracking:
Issue & Sub-Tasks
Issue Only
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works derby-470.diff 2005-07-28 02:23 AM Deepa Remesh 2 kB
File Licensed for inclusion in ASF works derby-470.status 2005-07-28 02:23 AM Deepa Remesh 0.2 kB
Environment: IBM's J2ME/CDC/Foundation Profile and JSR169

Resolution Date: 30/Sep/05 02:25 AM

Sub-Tasks  All   Open   

 Description  « Hide
As I did not get any response to my mail, I am opening a JIRA issue for this.

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();
      }
 }

As a solution, I am planning to do the following:
1. Check for BigDecimal class in the JVM by doing a Class.forName
2. Call getNumberAsString for NUMERIC and DECIMAL types only if BigDecimal class is available. Otherwise, return rs.getString.

This solution would mean that NUMERIC and DECIMAL types will not be localized in these JVM environments. Please let me know if any comments on this.

Thanks,
Deepa



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Deepa Remesh made changes - 28/Jul/05 02:23 AM
Field Original Value New Value
Attachment derby-470.status [ 12311426 ]
Attachment derby-470.diff [ 12311425 ]
Kathey Marsden made changes - 25/Aug/05 03:11 AM
Comment [ Committed revision 239718 to fix this issue. You can submit centralization of HAVE_BIG_DECIMAL as another patch or with other JS169 changes.

It seems to me that for sharing the function for multiple tools it would be better to put the internal api in a shared utility class under

D:/p4/marsden_patch/opensource/java/tools/org/apache/derby/iapi/tools/

rather than making the function in ij.util public.

Perhaps the fact that NUMERIC and DECIMAL types will not be localized in these JVM environments should be mentioned in the documentation,

]
Deepa Remesh made changes - 02/Sep/05 10:02 AM
Fix Version/s 10.2.0.0 [ 11187 ]
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 10.1.1.0 [ 10993 ]
Deepa Remesh made changes - 02/Sep/05 10:02 AM
Status Resolved [ 5 ] Closed [ 6 ]
Kathey Marsden made changes - 16/Sep/05 01:40 AM
Status Closed [ 6 ] Reopened [ 4 ]
Resolution Fixed [ 1 ]
Kathey Marsden made changes - 16/Sep/05 01:40 AM
Fix Version/s 10.1.2.0 [ 12310270 ]
Fix Version/s 10.1.1.0 [ 10993 ]
Kathey Marsden made changes - 16/Sep/05 01:40 AM
Resolution Fixed [ 1 ]
Status Reopened [ 4 ] Resolved [ 5 ]
Kathey Marsden made changes - 16/Sep/05 01:41 AM
Status Resolved [ 5 ] Closed [ 6 ]
Deepa Remesh made changes - 30/Sep/05 02:25 AM
Status Closed [ 6 ] Reopened [ 4 ]
Resolution Fixed [ 1 ]
Deepa Remesh made changes - 30/Sep/05 02:25 AM
Fix Version/s 10.1.1.1 [ 12310332 ]
Deepa Remesh made changes - 30/Sep/05 02:25 AM
Status Reopened [ 4 ] Closed [ 6 ]
Resolution Fixed [ 1 ]