Author: kmarsden
Date: Wed Aug 24 10:41:29 2005
New Revision: 239718
URL: http://svn.apache.org/viewcvs?rev=239718&view=rev
Log:
DERBY-470 - Exception when using LOCALIZEDDISPLAY with JSR169
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.
Contributed by Deepa Remesh
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/I18NImportExport_app.properties
db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/I18NImportExport_app.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/I18NImportExport_app.properties?rev=239718&r1=239717&r2=239718&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/I18NImportExport_app.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/I18NImportExport_app.properties
Wed Aug 24 10:41:29 2005
@@ -1,7 +1,4 @@
supportfiles=tests/i18n/data/Tab1_fr.ctrl,tests/i18n/data/Tab1_il.ctrl,tests/i18n/data/Tab1_jp.ctrl
usedefaults=true
derby.ui.locale=en_US
-useextdirs=true
-
-#Exclude for J2ME/Foundation - test requires java.math.BigDecimal
-runwithfoundation=false
\ No newline at end of file
+useextdirs=true
\ No newline at end of file
Modified: db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java?rev=239718&r1=239717&r2=239718&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
(original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
Wed Aug 24 10:41:29 2005
@@ -44,6 +44,19 @@
public final class LocalizedResource implements java.security.PrivilegedAction {
+ private static boolean HAVE_BIG_DECIMAL;
+
+ {
+ boolean haveBigDecimal;
+ try {
+ Class.forName("java.math.BigDecimal");
+ haveBigDecimal = true;
+ } catch (Throwable t) {
+ haveBigDecimal = false;
+ }
+ HAVE_BIG_DECIMAL = haveBigDecimal;
+ }
+
private ResourceBundle res;
private Locale locale;
private String encode;
@@ -305,7 +318,7 @@
type == Types.DOUBLE ) {
return getNumberAsString(rs.getDouble(columnNumber));
}
- else if (type == Types.NUMERIC || type == Types.DECIMAL ) {
+ else if (HAVE_BIG_DECIMAL && (type == Types.NUMERIC || type == Types.DECIMAL))
{
return getNumberAsString(rs.getBigDecimal(columnNumber,
rsm.getScale(columnNumber)));
}
|