From a8e90e358d62241b36ed7841ecd0f974ab24e1b7 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Tue, 1 Sep 2015 19:24:55 +0000 Subject: [PATCH] Fix some Forbidden APIs errors git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1700651 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/ss/formula/functions/Complex.java | 5 ++++- src/java/org/apache/poi/ss/usermodel/DateUtil.java | 11 ++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/java/org/apache/poi/ss/formula/functions/Complex.java b/src/java/org/apache/poi/ss/formula/functions/Complex.java index f63894e36d..628a2670ff 100644 --- a/src/java/org/apache/poi/ss/formula/functions/Complex.java +++ b/src/java/org/apache/poi/ss/formula/functions/Complex.java @@ -17,6 +17,8 @@ package org.apache.poi.ss.formula.functions; +import java.util.Locale; + import org.apache.poi.ss.formula.OperationEvaluationContext; import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.EvaluationException; @@ -94,7 +96,8 @@ public class Complex extends Var2or3ArgFunction implements FreeRefFunction { if (suffixValue.length() == 0) { 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; } if (!(suffixValue.equals(DEFAULT_SUFFIX) || suffixValue.equals(SUPPORTED_SUFFIX))) { diff --git a/src/java/org/apache/poi/ss/usermodel/DateUtil.java b/src/java/org/apache/poi/ss/usermodel/DateUtil.java index ff8ab4db2e..d202544d19 100644 --- a/src/java/org/apache/poi/ss/usermodel/DateUtil.java +++ b/src/java/org/apache/poi/ss/usermodel/DateUtil.java @@ -27,14 +27,6 @@ import java.util.regex.Pattern; /** * 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 { protected DateUtil() { @@ -669,7 +661,8 @@ public class DateUtil { int month = parseInt(monthStr, "month", 1, 12); 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); return cal.getTime(); } -- 2.39.5