mirror of https://github.com/apache/poi.git
Fix some Forbidden APIs errors
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1700652 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a8e90e358d
commit
546b36f6e0
|
@ -18,6 +18,7 @@
|
||||||
package org.apache.poi.hpsf;
|
package org.apache.poi.hpsf;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -52,9 +53,6 @@ import org.apache.poi.util.POILogger;
|
||||||
* href="http://msdn.microsoft.com/library/en-us/stg/stg/property_set_display_name_dictionary.asp?frame=true">
|
* href="http://msdn.microsoft.com/library/en-us/stg/stg/property_set_display_name_dictionary.asp?frame=true">
|
||||||
* Property Set Display Name Dictionary</a>.
|
* Property Set Display Name Dictionary</a>.
|
||||||
*
|
*
|
||||||
* @author Rainer Klute <a
|
|
||||||
* href="mailto:klute@rainer-klute.de"><klute@rainer-klute.de></a>
|
|
||||||
* @author Drew Varner (Drew.Varner InAndAround sc.edu)
|
|
||||||
* @see Section
|
* @see Section
|
||||||
* @see Variant
|
* @see Variant
|
||||||
*/
|
*/
|
||||||
|
@ -238,7 +236,7 @@ public class Property
|
||||||
{
|
{
|
||||||
/* Without a codepage the length is equal to the number of
|
/* Without a codepage the length is equal to the number of
|
||||||
* bytes. */
|
* bytes. */
|
||||||
b.append(new String(src, o, (int) sLength));
|
b.append(new String(src, o, (int) sLength, Charset.forName("ASCII")));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CodePageUtil.CP_UNICODE:
|
case CodePageUtil.CP_UNICODE:
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.text.MessageFormat;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.poi.hssf.model.HSSFFormulaParser;
|
import org.apache.poi.hssf.model.HSSFFormulaParser;
|
||||||
|
@ -55,10 +56,6 @@ public class DVConstraint implements DataValidationConstraint {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// convenient access to ValidationType namespace
|
|
||||||
private static final ValidationType VT = null;
|
|
||||||
|
|
||||||
|
|
||||||
private final int _validationType;
|
private final int _validationType;
|
||||||
private int _operator;
|
private int _operator;
|
||||||
private String[] _explicitListValues;
|
private String[] _explicitListValues;
|
||||||
|
@ -184,7 +181,7 @@ public class DVConstraint implements DataValidationConstraint {
|
||||||
throw new IllegalArgumentException("expr1 must be supplied");
|
throw new IllegalArgumentException("expr1 must be supplied");
|
||||||
}
|
}
|
||||||
OperatorType.validateSecondArg(comparisonOperator, expr2);
|
OperatorType.validateSecondArg(comparisonOperator, expr2);
|
||||||
SimpleDateFormat df = dateFormat == null ? null : new SimpleDateFormat(dateFormat);
|
SimpleDateFormat df = dateFormat == null ? null : new SimpleDateFormat(dateFormat, Locale.ROOT);
|
||||||
|
|
||||||
// formula1 and value1 are mutually exclusive
|
// formula1 and value1 are mutually exclusive
|
||||||
String formula1 = getFormulaFromTextExpression(expr1);
|
String formula1 = getFormulaFromTextExpression(expr1);
|
||||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.poi.ss.formula.atp;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.TimeZone;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.poi.ss.formula.eval.ErrorEval;
|
import org.apache.poi.ss.formula.eval.ErrorEval;
|
||||||
|
@ -26,10 +28,13 @@ import org.apache.poi.ss.formula.eval.EvaluationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parser for java dates.
|
* Parser for java dates.
|
||||||
*
|
|
||||||
* @author jfaenomoto@gmail.com
|
|
||||||
*/
|
*/
|
||||||
public class DateParser {
|
public class DateParser {
|
||||||
|
/**
|
||||||
|
* Excel doesn't store TimeZone information in the file, so if in doubt,
|
||||||
|
* use UTC to perform calculations
|
||||||
|
*/
|
||||||
|
private static final TimeZone DEFAULT_TIMEZONE = TimeZone.getTimeZone("UTC");
|
||||||
|
|
||||||
public DateParser instance = new DateParser();
|
public DateParser instance = new DateParser();
|
||||||
|
|
||||||
|
@ -90,7 +95,8 @@ public class DateParser {
|
||||||
if (month < 1 || month > 12) {
|
if (month < 1 || month > 12) {
|
||||||
throw new EvaluationException(ErrorEval.VALUE_INVALID);
|
throw new EvaluationException(ErrorEval.VALUE_INVALID);
|
||||||
}
|
}
|
||||||
Calendar cal = new GregorianCalendar(year, month - 1, 1, 0, 0, 0);
|
Calendar cal = new GregorianCalendar(DEFAULT_TIMEZONE, Locale.ROOT);
|
||||||
|
cal.set(year, month - 1, 1, 0, 0, 0);
|
||||||
cal.set(Calendar.MILLISECOND, 0);
|
cal.set(Calendar.MILLISECOND, 0);
|
||||||
if (day < 1 || day > cal.getActualMaximum(Calendar.DAY_OF_MONTH)) {
|
if (day < 1 || day > cal.getActualMaximum(Calendar.DAY_OF_MONTH)) {
|
||||||
throw new EvaluationException(ErrorEval.VALUE_INVALID);
|
throw new EvaluationException(ErrorEval.VALUE_INVALID);
|
||||||
|
|
Loading…
Reference in New Issue