Fix some Forbidden APIs errors

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1700651 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2015-09-01 19:24:55 +00:00
parent 8265e2e95e
commit 64416b4d84
2 changed files with 6 additions and 10 deletions

View File

@ -17,6 +17,8 @@
package org.apache.poi.ss.formula.functions; package org.apache.poi.ss.formula.functions;
import java.util.Locale;
import org.apache.poi.ss.formula.OperationEvaluationContext; import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.formula.eval.EvaluationException; import org.apache.poi.ss.formula.eval.EvaluationException;
@ -94,7 +96,8 @@ public class Complex extends Var2or3ArgFunction implements FreeRefFunction {
if (suffixValue.length() == 0) { if (suffixValue.length() == 0) {
suffixValue = DEFAULT_SUFFIX; suffixValue = DEFAULT_SUFFIX;
} }
if (suffixValue.equals(DEFAULT_SUFFIX.toUpperCase()) || suffixValue.equals(SUPPORTED_SUFFIX.toUpperCase())) { if (suffixValue.equals(DEFAULT_SUFFIX.toUpperCase(Locale.ROOT)) ||
suffixValue.equals(SUPPORTED_SUFFIX.toUpperCase(Locale.ROOT))) {
return ErrorEval.VALUE_INVALID; return ErrorEval.VALUE_INVALID;
} }
if (!(suffixValue.equals(DEFAULT_SUFFIX) || suffixValue.equals(SUPPORTED_SUFFIX))) { if (!(suffixValue.equals(DEFAULT_SUFFIX) || suffixValue.equals(SUPPORTED_SUFFIX))) {

View File

@ -27,14 +27,6 @@ import java.util.regex.Pattern;
/** /**
* Contains methods for dealing with Excel dates. * Contains methods for dealing with Excel dates.
*
* @author Michael Harhen
* @author Glen Stampoultzis (glens at apache.org)
* @author Dan Sherman (dsherman at isisph.com)
* @author Hack Kampbjorn (hak at 2mba.dk)
* @author Alex Jacoby (ajacoby at gmail.com)
* @author Pavel Krupets (pkrupets at palmtreebusiness dot com)
* @author Thies Wellpott
*/ */
public class DateUtil { public class DateUtil {
protected DateUtil() { protected DateUtil() {
@ -669,7 +661,8 @@ public class DateUtil {
int month = parseInt(monthStr, "month", 1, 12); int month = parseInt(monthStr, "month", 1, 12);
int day = parseInt(dayStr, "day", 1, 31); int day = parseInt(dayStr, "day", 1, 31);
Calendar cal = new GregorianCalendar(year, month-1, day, 0, 0, 0); Calendar cal = new GregorianCalendar(TIMEZONE_UTC, Locale.ROOT);
cal.set(year, month-1, day, 0, 0, 0);
cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.MILLISECOND, 0);
return cal.getTime(); return cal.getTime();
} }