Changed JRE 6 dependent code to its JRE 5 equivalent

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@947842 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2010-05-24 22:41:51 +00:00
parent 046c73ba82
commit b9e43015df
2 changed files with 22 additions and 23 deletions

View File

@ -20,6 +20,7 @@ package org.apache.poi.hssf.record.formula.functions;
import java.text.DecimalFormatSymbols; import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.Locale;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.poi.hssf.record.formula.eval.ErrorEval; import org.apache.poi.hssf.record.formula.eval.ErrorEval;
@ -50,8 +51,8 @@ public final class TestText extends TestCase {
ValueEval formatArg = new StringEval("#,###.00000"); ValueEval formatArg = new StringEval("#,###.00000");
ValueEval[] args = { numArg, formatArg }; ValueEval[] args = { numArg, formatArg };
ValueEval result = T.TEXT.evaluate(args, -1, (short)-1); ValueEval result = T.TEXT.evaluate(args, -1, (short)-1);
char groupSeparator = DecimalFormatSymbols.getInstance().getGroupingSeparator(); char groupSeparator = new DecimalFormatSymbols(Locale.getDefault()).getGroupingSeparator();
char decimalSeparator = DecimalFormatSymbols.getInstance().getDecimalSeparator(); char decimalSeparator = new DecimalFormatSymbols(Locale.getDefault()).getDecimalSeparator();
ValueEval testResult = new StringEval("321" + groupSeparator + "321" + decimalSeparator + "32100"); ValueEval testResult = new StringEval("321" + groupSeparator + "321" + decimalSeparator + "32100");
assertEquals(testResult.toString(), result.toString()); assertEquals(testResult.toString(), result.toString());
numArg = new NumberEval(321.321); numArg = new NumberEval(321.321);
@ -109,6 +110,4 @@ public final class TestText extends TestCase {
testResult = new StringEval(november + " 16, 1900"); testResult = new StringEval(november + " 16, 1900");
assertEquals(testResult.toString(), result.toString()); assertEquals(testResult.toString(), result.toString());
} }
} }

View File

@ -104,7 +104,7 @@ public class CellFormatTestBase extends TestCase {
String format = row.getCell(1).getStringCellValue(); String format = row.getCell(1).getStringCellValue();
String testCategoryList = row.getCell(3).getStringCellValue(); String testCategoryList = row.getCell(3).getStringCellValue();
boolean byCategory = runByCategory(runCategories, testCategoryList); boolean byCategory = runByCategory(runCategories, testCategoryList);
if ((!expectedText.isEmpty() || !format.isEmpty()) && byCategory) { if ((expectedText.length() > 0 || format.length() > 0) && byCategory) {
Cell cell = row.getCell(2); Cell cell = row.getCell(2);
tryFormat(r, expectedText, format, valueGetter, cell); tryFormat(r, expectedText, format, valueGetter, cell);
} }