poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1700635 - in /poi/trunk/src: java/org/apache/poi/ss/formula/functions/ java/org/apache/poi/ss/usermodel/ ooxml/testcases/org/apache/poi/xssf/usermodel/ scratchpad/src/org/apache/poi/hslf/util/ testcases/org/apache/poi/hpsf/basic/ testcases...
Date Tue, 01 Sep 2015 18:37:08 GMT
Author: nick
Date: Tue Sep  1 18:37:07 2015
New Revision: 1700635

URL: http://svn.apache.org/r1700635
Log:
Fix some Forbidden APIs errors

Modified:
    poi/trunk/src/java/org/apache/poi/ss/formula/functions/DateFunc.java
    poi/trunk/src/java/org/apache/poi/ss/formula/functions/Days360.java
    poi/trunk/src/java/org/apache/poi/ss/formula/functions/EOMonth.java
    poi/trunk/src/java/org/apache/poi/ss/formula/functions/Today.java
    poi/trunk/src/java/org/apache/poi/ss/formula/functions/WeekNum.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/DateUtil.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/util/SystemTimeUtils.java
    poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestYearFracCalculator.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestDays360.java

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/functions/DateFunc.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/functions/DateFunc.java?rev=1700635&r1=1700634&r2=1700635&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/functions/DateFunc.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/functions/DateFunc.java Tue Sep  1 18:37:07
2015
@@ -19,6 +19,7 @@ package org.apache.poi.ss.formula.functi
 
 import java.util.Calendar;
 import java.util.GregorianCalendar;
+import java.util.Locale;
 
 import org.apache.poi.ss.formula.eval.ErrorEval;
 import org.apache.poi.ss.formula.eval.EvaluationException;
@@ -86,7 +87,7 @@ public final class DateFunc extends Fixe
 		}
 
 		// Turn this into a Java date
-		Calendar c = new GregorianCalendar();
+		Calendar c = new GregorianCalendar(Locale.ROOT);
 		c.set(year, month, day, 0, 0, 0);
 		c.set(Calendar.MILLISECOND, 0);
 		

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/functions/Days360.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/functions/Days360.java?rev=1700635&r1=1700634&r2=1700635&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/functions/Days360.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/functions/Days360.java Tue Sep  1 18:37:07
2015
@@ -18,6 +18,7 @@ package org.apache.poi.ss.formula.functi
 
 import java.util.Calendar;
 import java.util.GregorianCalendar;
+import java.util.Locale;
 
 import org.apache.poi.ss.formula.eval.EvaluationException;
 import org.apache.poi.ss.formula.eval.NumberEval;
@@ -72,7 +73,7 @@ public class Days360 extends Var2or3ArgF
     }
 
     private static Calendar getDate(double date) {
-        Calendar processedDate = new GregorianCalendar();
+        Calendar processedDate = new GregorianCalendar(Locale.ROOT);
         processedDate.setTime(DateUtil.getJavaDate(date, false));
         return processedDate;
     }

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/functions/EOMonth.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/functions/EOMonth.java?rev=1700635&r1=1700634&r2=1700635&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/functions/EOMonth.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/functions/EOMonth.java Tue Sep  1 18:37:07
2015
@@ -20,6 +20,7 @@ package org.apache.poi.ss.formula.functi
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
+import java.util.Locale;
 
 import org.apache.poi.ss.formula.OperationEvaluationContext;
 import org.apache.poi.ss.formula.eval.ErrorEval;
@@ -63,7 +64,7 @@ public class EOMonth implements FreeRefF
 
             Date startDate = DateUtil.getJavaDate(startDateAsNumber, false);
 
-            Calendar cal = new GregorianCalendar();
+            Calendar cal = new GregorianCalendar(Locale.ROOT);
             cal.setTime(startDate);
             cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH),
0, 0, 0);
             cal.set(Calendar.MILLISECOND, 0);

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/functions/Today.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/functions/Today.java?rev=1700635&r1=1700634&r2=1700635&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/functions/Today.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/functions/Today.java Tue Sep  1 18:37:07
2015
@@ -19,6 +19,7 @@ package org.apache.poi.ss.formula.functi
 
 import java.util.Calendar;
 import java.util.GregorianCalendar;
+import java.util.Locale;
 
 import org.apache.poi.ss.formula.eval.NumberEval;
 import org.apache.poi.ss.formula.eval.ValueEval;
@@ -33,7 +34,7 @@ public final class Today extends Fixed0A
 
 	public ValueEval evaluate(int srcRowIndex, int srcColumnIndex) {
 
-		Calendar now = new GregorianCalendar();
+		Calendar now = new GregorianCalendar(Locale.ROOT);
 		now.set(now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DATE),0,0,0);
 		now.set(Calendar.MILLISECOND, 0);
 		return new NumberEval(DateUtil.getExcelDate(now.getTime()));

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/functions/WeekNum.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/functions/WeekNum.java?rev=1700635&r1=1700634&r2=1700635&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/functions/WeekNum.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/functions/WeekNum.java Tue Sep  1 18:37:07
2015
@@ -23,6 +23,7 @@ import org.apache.poi.ss.usermodel.DateU
 
 import java.util.Calendar;
 import java.util.GregorianCalendar;
+import java.util.Locale;
 
 /**
  * Implementation for Excel WeekNum() function.<p/>
@@ -52,7 +53,7 @@ public class WeekNum extends Fixed2ArgFu
         } catch (EvaluationException e) {
             return ErrorEval.VALUE_INVALID;
         }
-        Calendar serialNumCalendar = new GregorianCalendar();
+        Calendar serialNumCalendar = new GregorianCalendar(Locale.ROOT);
         serialNumCalendar.setTime(DateUtil.getJavaDate(serialNum, false));
 
         int returnType = 0;

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/DateUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/DateUtil.java?rev=1700635&r1=1700634&r2=1700635&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/DateUtil.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/DateUtil.java Tue Sep  1 18:37:07 2015
@@ -21,6 +21,7 @@ package org.apache.poi.ss.usermodel;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
+import java.util.Locale;
 import java.util.TimeZone;
 import java.util.regex.Pattern;
 
@@ -83,7 +84,7 @@ public class DateUtil {
      * @param use1904windowing Should 1900 or 1904 date windowing be used?
      */
     public static double getExcelDate(Date date, boolean use1904windowing) {
-        Calendar calStart = new GregorianCalendar();
+        Calendar calStart = new GregorianCalendar(Locale.ROOT);
         calStart.setTime(date);   // If date includes hours, minutes, and seconds, set them
to 0
         return internalGetExcelDate(calStart, use1904windowing);
     }
@@ -319,9 +320,9 @@ public class DateUtil {
         int millisecondsInDay = (int)((date - wholeDays) * DAY_MILLISECONDS + 0.5);
         Calendar calendar;
         if (timeZone != null) {
-            calendar = new GregorianCalendar(timeZone);
+            calendar = new GregorianCalendar(timeZone, Locale.ROOT);
         } else {
-            calendar = new GregorianCalendar();     // using default time-zone
+            calendar = new GregorianCalendar(Locale.ROOT); // using default time-zone
         }
         setCalendar(calendar, wholeDays, millisecondsInDay, use1904windowing, roundSeconds);
         return calendar;

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java?rev=1700635&r1=1700634&r2=1700635&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java Tue Sep
 1 18:37:07 2015
@@ -26,6 +26,7 @@ import java.nio.charset.Charset;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
+import java.util.Locale;
 
 import junit.framework.TestCase;
 
@@ -142,14 +143,14 @@ public final class TestUnfixedBugs exten
         // second to be different here!
         int startYear = 1900;
         int dayAdjust = -1; // Excel thinks 2/29/1900 is a valid date, which it isn't
-        Calendar calendar1 = new GregorianCalendar();
+        Calendar calendar1 = new GregorianCalendar(Locale.ROOT);
         calendar1.set(startYear,0, wholeDays1 + dayAdjust, 0, 0, 0);
         calendar1.set(Calendar.MILLISECOND, millisecondsInDay1);
       // this is the rounding part:
       calendar1.add(Calendar.MILLISECOND, 500);
       calendar1.clear(Calendar.MILLISECOND);
 
-        Calendar calendar2 = new GregorianCalendar();
+        Calendar calendar2 = new GregorianCalendar(Locale.ROOT);
         calendar2.set(startYear,0, wholeDays2 + dayAdjust, 0, 0, 0);
         calendar2.set(Calendar.MILLISECOND, millisecondsInDay2);
       // this is the rounding part:

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/util/SystemTimeUtils.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/util/SystemTimeUtils.java?rev=1700635&r1=1700634&r2=1700635&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/util/SystemTimeUtils.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/util/SystemTimeUtils.java Tue Sep  1
18:37:07 2015
@@ -20,6 +20,7 @@ package org.apache.poi.hslf.util;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
+import java.util.Locale;
 
 import org.apache.poi.util.LittleEndian;
 
@@ -47,7 +48,7 @@ public final class SystemTimeUtils {
 	 * Get the date found in the byte array, as a java Data object
 	 */
 	public static Date getDate(byte[] data, int offset) {
-        Calendar cal = new GregorianCalendar();
+        Calendar cal = new GregorianCalendar(Locale.ROOT);
 
         cal.set(Calendar.YEAR,         LittleEndian.getShort(data,offset));
         cal.set(Calendar.MONTH,        LittleEndian.getShort(data,offset+2)-1);

Modified: poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java?rev=1700635&r1=1700634&r2=1700635&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java Tue Sep  1 18:37:07
2015
@@ -28,6 +28,7 @@ import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 
 import junit.framework.TestCase;
@@ -227,7 +228,7 @@ public class TestWriteWellKnown extends
          * (e.g. author, edit date, application name) and to the document
          * summary information (e.g. company, manager).
          */
-        Calendar cal = new GregorianCalendar();
+        Calendar cal = new GregorianCalendar(Locale.ROOT);
         cal.set(2000, 6, 6, 6, 6, 6);
         final long time1 = cal.getTimeInMillis();
         cal.set(2001, 7, 7, 7, 7, 7);

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java?rev=1700635&r1=1700634&r2=1700635&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java Tue Sep  1
18:37:07 2015
@@ -25,6 +25,7 @@ import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
+import java.util.Locale;
 import java.util.TimeZone;
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
@@ -461,7 +462,7 @@ public final class TestHSSFDateUtil {
      * @param day one based
      */
     private static Date createDate(int year, int month, int day, int hour, int minute, int
second) {
-        Calendar c = new GregorianCalendar();
+        Calendar c = new GregorianCalendar(Locale.ROOT);
         c.set(year, month, day, hour, minute, second);
         c.set(Calendar.MILLISECOND, 0);
         return c.getTime();

Modified: poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestYearFracCalculator.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestYearFracCalculator.java?rev=1700635&r1=1700634&r2=1700635&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestYearFracCalculator.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestYearFracCalculator.java Tue
Sep  1 18:37:07 2015
@@ -19,6 +19,7 @@ package org.apache.poi.ss.formula.atp;
 
 import java.util.Calendar;
 import java.util.GregorianCalendar;
+import java.util.Locale;
 
 import junit.framework.TestCase;
 
@@ -58,7 +59,7 @@ public final class TestYearFracCalculato
 	}
 
 	private static double md(int year, int month, int day) {
-		Calendar c = new GregorianCalendar();
+		Calendar c = new GregorianCalendar(Locale.ROOT);
 		
 		c.set(year, month-1, day, 0, 0, 0);
 		c.set(Calendar.MILLISECOND, 0);

Modified: poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestDays360.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestDays360.java?rev=1700635&r1=1700634&r2=1700635&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestDays360.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestDays360.java Tue Sep 
1 18:37:07 2015
@@ -20,6 +20,7 @@ package org.apache.poi.ss.formula.functi
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
+import java.util.Locale;
 
 import junit.framework.AssertionFailedError;
 import junit.framework.TestCase;
@@ -44,13 +45,13 @@ public final class TestDays360 extends T
 		return cal.getTime();
 	}
 	private static Date decrementDay(Date d) {
-		Calendar c = new GregorianCalendar();
+		Calendar c = new GregorianCalendar(Locale.ROOT);
 		c.setTimeInMillis(d.getTime());
 		c.add(Calendar.DAY_OF_MONTH, -1);
 		return c.getTime();
 	}
 	private static String fmt(Date d) {
-		Calendar c = new GregorianCalendar();
+		Calendar c = new GregorianCalendar(Locale.ROOT);
 		c.setTimeInMillis(d.getTime());
 		StringBuilder sb = new StringBuilder();
 		sb.append(c.get(Calendar.YEAR));



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message