Author: kiwiwings
Date: Fri Oct 23 22:30:33 2020
New Revision: 1882792

URL: http://svn.apache.org/viewvc?rev=1882792&view=rev
Log:
try to fix sonar build

Removed:
    poi/trunk/sonar/ooxml-schema-encryption/
    poi/trunk/sonar/ooxml-schema-security/
Modified:
    poi/trunk/sonar/integration-test/pom.xml
    poi/trunk/sonar/main/pom.xml
    poi/trunk/sonar/ooxml-schema/pom.xml
    poi/trunk/sonar/ooxml/pom.xml
    poi/trunk/sonar/pom.xml
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
    
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java

Modified: poi/trunk/sonar/integration-test/pom.xml
URL: 
http://svn.apache.org/viewvc/poi/trunk/sonar/integration-test/pom.xml?rev=1882792&r1=1882791&r2=1882792&view=diff
==============================================================================
--- poi/trunk/sonar/integration-test/pom.xml (original)
+++ poi/trunk/sonar/integration-test/pom.xml Fri Oct 23 22:30:33 2020
@@ -18,7 +18,7 @@
             <!-- copy sources, resources and tests in place as otherwise Sonar 
does not pick them up correctly! -->
             <plugin>
                 <artifactId>maven-resources-plugin</artifactId>
-                <version>${maven.plugin.resources.version}</version>
+<!--                <version>${mavnen.plugin.resources.version}</version>-->
                 <executions>
                     <execution>
                         <id>copy-tests</id>
@@ -32,6 +32,15 @@
                                 <resource>
                                     
<directory>../../src/integrationtest</directory>
                                 </resource>
+                                <resource>
+                                    <directory>../../src/testcases</directory>
+                                    <includes>
+                                        
<include>org/apache/poi/POIDataSamples.java</include>
+                                        
<include>org/apache/poi/util/NullPrintStream.java</include>
+                                        
<include>org/apache/poi/util/NullOutputStream.java</include>
+                                        
<include>org/apache/poi/hssf/HSSFTestDataSamples.java</include>
+                                    </includes>
+                                </resource>
                             </resources>
                         </configuration>
                     </execution>

Modified: poi/trunk/sonar/main/pom.xml
URL: 
http://svn.apache.org/viewvc/poi/trunk/sonar/main/pom.xml?rev=1882792&r1=1882791&r2=1882792&view=diff
==============================================================================
--- poi/trunk/sonar/main/pom.xml (original)
+++ poi/trunk/sonar/main/pom.xml Fri Oct 23 22:30:33 2020
@@ -28,12 +28,12 @@
                                                </goals>
                                                <configuration>
                                                        
<outputDirectory>${basedir}/src/main/java</outputDirectory>
-                                                       <resources>          
+                                                       <resources>
                                                                <resource>
                                                                        
<directory>../../src/java</directory>
                                                                </resource>
-                                                       </resources>            
  
-                                               </configuration>            
+                                                       </resources>
+                                               </configuration>
                                        </execution>
                                        <execution>
                                                <id>copy-resources</id>
@@ -43,12 +43,12 @@
                                                </goals>
                                                <configuration>
                                                        
<outputDirectory>${basedir}/src/main/resources</outputDirectory>
-                                                       <resources>          
+                                                       <resources>
                                                                <resource>
                                                                        
<directory>../../src/resources/main</directory>
                                                                </resource>
-                                                       </resources>            
  
-                                               </configuration>            
+                                                       </resources>
+                                               </configuration>
                                        </execution>
                                        <execution>
                                                <id>copy-tests</id>
@@ -59,12 +59,12 @@
                                                </goals>
                                                <configuration>
                                                        
<outputDirectory>${basedir}/src/test/java</outputDirectory>
-                                                       <resources>          
+                                                       <resources>
                                                                <resource>
                                                                        
<directory>../../src/testcases</directory>
                                                                </resource>
-                                                       </resources>            
  
-                                               </configuration>            
+                                                       </resources>
+                                               </configuration>
                                        </execution>
                                </executions>
                        </plugin>
@@ -81,8 +81,8 @@
                         </fileset>
                     </filesets>
                 </configuration>
-            </plugin>                  
-                       
+            </plugin>
+
                        <!-- provide the test-jar for other modules -->
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
@@ -96,16 +96,6 @@
                                        </execution>
                                </executions>
                        </plugin>
-
-            <!-- set jvm parameters for surefire plugin -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <version>${maven.plugin.surefire.version}</version>
-                <configuration>
-                    <argLine>@{argLine} -Duser.language=en -Duser.country=US 
-Xmx1024m -Djava.io.tmpdir=${basedir}/target/tmp 
-XX:-OmitStackTraceInFastThrow</argLine>
-                </configuration>
-            </plugin>
                </plugins>
     </build>
 
@@ -135,25 +125,5 @@
             <artifactId>commons-logging</artifactId>
             <version>1.2</version>
         </dependency>
-        <dependency>
-            <groupId>javax.xml.bind</groupId>
-            <artifactId>jaxb-api</artifactId>
-            <version>2.3.1</version>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-impl</artifactId>
-            <version>2.3.2</version>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-core</artifactId>
-            <version>2.3.0.1</version>
-        </dependency>
-        <dependency>
-            <groupId>javax.activation</groupId>
-            <artifactId>activation</artifactId>
-            <version>1.1.1</version>
-        </dependency>
     </dependencies>
 </project>

Modified: poi/trunk/sonar/ooxml-schema/pom.xml
URL: 
http://svn.apache.org/viewvc/poi/trunk/sonar/ooxml-schema/pom.xml?rev=1882792&r1=1882791&r2=1882792&view=diff
==============================================================================
--- poi/trunk/sonar/ooxml-schema/pom.xml (original)
+++ poi/trunk/sonar/ooxml-schema/pom.xml Fri Oct 23 22:30:33 2020
@@ -18,58 +18,125 @@
                <!-- see 
http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus for details of this 
property -->
                <sonar.exclusions>target/generated-sources/*</sonar.exclusions>
                <maven.compiler.fork>true</maven.compiler.fork>
-               
<xmlbeans.xsdconfig>${basedir}/../../src/ooxml/resources/org/apache/poi/schemas/ooxmlSchemas.xsdconfig</xmlbeans.xsdconfig>
        </properties>
 
     <build>
                <plugins>
-                       <!-- Download and unpack the OfficeOpenXML Schema and 
use xmlbeans to create classes from the XSDs -->
                        <plugin>
-                               
<groupId>com.googlecode.maven-download-plugin</groupId>
-                               <artifactId>download-maven-plugin</artifactId>
-                               
<version>${maven.plugin.download.version}</version>
+                               <artifactId>maven-antrun-plugin</artifactId>
+                               
<version>${maven.plugin.antrun.version}</version>
                                <executions>
                                        <execution>
-                                               <id>download-xsds</id>
+                                               
<id>copy-xmltype-and-xsdconfig</id>
                                                <phase>generate-sources</phase>
                                                <goals>
-                                                       <goal>wget</goal>
+                                                       <goal>run</goal>
                                                </goals>
                                                <configuration>
-                                                       
<url>https://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%201st%20edition%20Part%204%20(PDF).zip</url>
-                                                       <unpack>true</unpack>
-                                                       
<md5>abe6bb6e7799e854934b3c634e8bcf7b</md5>
+                                                       <target>
+                                                               <property 
name="xsdir" value="${basedir}/../../src/ooxml/resources/org/apache/poi"/>
+                                                               <copy 
todir="${basedir}/target/schemas">
+                                                                       
<zipfileset src="${xsdir}/schemas/OfficeOpenXML-XMLSchema.zip"/>
+                                                                       
<zipfileset src="${xsdir}/schemas/OpenPackagingConventions-XMLSchema.zip" 
includes="opc-digSig.xsd,opc-relationships.xsd"/>
+                                                                       
<fileset dir="${xsdir}/xdgf" includes="*.xsd,*.xsdconfig"/>
+                                                                       
<fileset dir="${xsdir}/schemas" includes="*.xsd,*.xsdconfig"/>
+                                                                       
<fileset dir="${xsdir}/poifs/crypt" includes="signatureInfo.xsd"/>
+                                                               </copy>
+                                                       </target>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>
 
                        <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-antrun-plugin</artifactId>
-                               
<version>${maven.plugin.antrun.version}</version>
+                               <groupId>org.codehaus.mojo</groupId>
+                               <artifactId>exec-maven-plugin</artifactId>
+                               <version>3.0.0</version>
                                <executions>
                                        <execution>
-                                               <id>unzip-schema</id>
-                                               <phase>generate-sources</phase>
-                                               <configuration>
-                                                       <target>
-                                                               <echo 
message="unzip schemas" />
-                                                               <unzip 
src="target/OfficeOpenXML-XMLSchema.zip" dest="target/schemas" />
-                                                               <copy 
file="../../src/ooxml/resources/org/apache/poi/xdgf/visio.xsd"
-                                                                       
todir="target/schemas"/>
-                                                       </target>
-                                               </configuration>
+                                               <phase>process-sources</phase>
                                                <goals>
-                                                       <goal>run</goal>
+                                                       <!-- need to use exec 
instead of java, because SchemaCompiler calls System.exit() -->
+                                                       <goal>exec</goal>
                                                </goals>
                                        </execution>
                                </executions>
+                               <configuration>
+                                       <executable>java</executable>
+                                       <arguments>
+                                               <argument>-classpath</argument>
+                                               <!-- automatically creates the 
classpath using all project dependencies,
+                                                        also adding the 
project build directory -->
+                                               <classpath/>
+                                               
<argument>org.apache.xmlbeans.impl.tool.SchemaCompiler</argument>
+                                               <argument>-srconly</argument>
+                                               <argument>-name</argument>
+                                               <argument>ooxml</argument>
+                                               <argument>-repackage</argument>
+                                               
<argument>org.apache.xmlbeans.metadata:org.apache.poi.schemas.ooxml</argument>
+                                               <argument>-d</argument>
+                                               
<argument>${basedir}/target/generated-resources</argument>
+                                               <argument>-src</argument>
+                                               
<argument>${basedir}/target/generated-sources</argument>
+                                               
<argument>${basedir}/target/schemas</argument>
+                                       </arguments>
+                                       <additionalClasspathElements>
+                                               <additionalClasspathElement>
+                                                       
${basedir}/../../lib/ooxml/xmlbeans-4.0.0.jar
+                                               </additionalClasspathElement>
+                                       </additionalClasspathElements>
+                               </configuration>
+                       </plugin>
+
+                       <plugin>
+                               <groupId>org.codehaus.mojo</groupId>
+                               
<artifactId>build-helper-maven-plugin</artifactId>
+                               <version>3.2.0</version>
+                               <executions>
+                                       <execution>
+                                               <id>add-source</id>
+                                               <goals>
+                                                       <goal>add-source</goal>
+                                                       
<goal>add-resource</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <resources>
+                                                               <resource>
+                                                                       
<directory>${basedir}/target/generated-resources</directory>
+                                                               </resource>
+                                                               <resource>
+                                                                       
<directory>${basedir}/../../src/multimodule/ooxml-schemas/java9</directory>
+                                                                       
<targetPath>META-INF/versions/9</targetPath>
+                                                                       
<includes>
+                                                                               
<include>*.class</include>
+                                                                       
</includes>
+                                                               </resource>
+                                                       </resources>
+                                                       <sources>
+                                                               
<source>${basedir}/target/generated-sources</source>
+                                                       </sources>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-jar-plugin</artifactId>
+                               <version>3.2.0</version>
+                               <configuration>
+                                       <archive>
+                                               <manifestEntries>
+                                                       
<Multi-Release>true</Multi-Release>
+                                                       
<Automatic-Module-Name>org.apache.poi.ooxml.schemas</Automatic-Module-Name>
+                                               </manifestEntries>
+                                       </archive>
+                               </configuration>
                        </plugin>
                </plugins>
     </build>
 
-    <dependencies>
+       <dependencies>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>poi-main</artifactId>

Modified: poi/trunk/sonar/ooxml/pom.xml
URL: 
http://svn.apache.org/viewvc/poi/trunk/sonar/ooxml/pom.xml?rev=1882792&r1=1882791&r2=1882792&view=diff
==============================================================================
--- poi/trunk/sonar/ooxml/pom.xml (original)
+++ poi/trunk/sonar/ooxml/pom.xml Fri Oct 23 22:30:33 2020
@@ -107,16 +107,6 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
-            <artifactId>poi-ooxml-schema-encryption</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>poi-ooxml-schema-security</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
             <artifactId>poi-main</artifactId>
             <version>${project.version}</version>
         </dependency>
@@ -186,6 +176,13 @@
             <scope>test</scope>
         </dependency>
 
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>29.0-jre</version>
+            <scope>test</scope>
+        </dependency>
+
         <dependency>
             <!-- don't add it to the distribution -->
             <groupId>org.apache.xmlgraphics</groupId>

Modified: poi/trunk/sonar/pom.xml
URL: 
http://svn.apache.org/viewvc/poi/trunk/sonar/pom.xml?rev=1882792&r1=1882791&r2=1882792&view=diff
==============================================================================
--- poi/trunk/sonar/pom.xml (original)
+++ poi/trunk/sonar/pom.xml Fri Oct 23 22:30:33 2020
@@ -58,8 +58,6 @@
     <modules>
         <module>main</module>
         <module>ooxml-schema</module>
-        <module>ooxml-schema-encryption</module>
-        <module>ooxml-schema-security</module>
         <module>ooxml</module>
         <module>scratchpad</module>
         <module>excelant</module>
@@ -85,12 +83,12 @@
         <junit.version>4.13</junit.version>
         <xmlunit.version>2.7.0</xmlunit.version>
         <mockito.version>3.5.15</mockito.version>
-        <maven.plugin.resources.version>3.1.0</maven.plugin.resources.version>
+        <maven.plugin.resources.version>3.2.0</maven.plugin.resources.version>
         <maven.plugin.jar.version>3.2.0</maven.plugin.jar.version>
         <maven.plugin.clean.version>3.1.0</maven.plugin.clean.version>
-        <maven.plugin.download.version>1.5.0</maven.plugin.download.version>
-        <maven.plugin.antrun.version>1.8</maven.plugin.antrun.version>
-        <maven.plugin.surefire.version>3.0.0-M4</maven.plugin.surefire.version>
+        <maven.plugin.download.version>1.6.0</maven.plugin.download.version>
+        <maven.plugin.antrun.version>3.0.0</maven.plugin.antrun.version>
+        <maven.plugin.surefire.version>3.0.0-M5</maven.plugin.surefire.version>
     </properties>
 
     <build>
@@ -126,8 +124,7 @@
                         
<org.apache.poi.util.POILogger>org.apache.poi.util.NullLogger</org.apache.poi.util.POILogger>
                     </systemPropertyVariables>
                     <!-- use to following to analyze OOM issues:       
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -->
-                    <argLine>@{argLine} -Duser.language=en -Duser.country=US 
-Xmx1024m -Djava.io.tmpdir=${basedir}/target/tmp
-                    </argLine>
+                    <argLine>@{argLine} -Duser.language=en -Duser.country=US 
-Xmx1024m -Djava.io.tmpdir=${basedir}/target/tmp 
-XX:-OmitStackTraceInFastThrow</argLine>
                     <excludes>
                         <exclude>**/All*Tests.java</exclude>
                         <exclude>**/TestUnfixedBugs.java</exclude>
@@ -221,140 +218,5 @@
             </properties>
         </profile>
 
-        <profile>
-            <id>xmlbean</id>
-            <activation>
-                <file>
-                    <exists>xmlbeans.marker</exists>
-                </file>
-            </activation>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.codehaus.mojo</groupId>
-                        <artifactId>xmlbeans-maven-plugin</artifactId>
-                        <version>2.3.3</version>
-                        <executions>
-                            <execution>
-                                <phase>process-sources</phase>
-                                <goals>
-                                    <goal>xmlbeans</goal>
-                                </goals>
-                                <configuration>
-                                    
<schemaDirectory>${basedir}/target/schemas</schemaDirectory>
-                                    <javaSource>1.5</javaSource>
-                                    <noJavac>true</noJavac>
-                                    <noUpa>${xmlbeans.noUpa}</noUpa>
-                                    <noPvr>${xmlbeans.noPvr}</noPvr>
-                                    <xmlConfigs>
-                                        <xmlConfig 
implementation="java.io.File">
-                                            
${basedir}/../../src/ooxml/resources/org/apache/poi/poifs/crypt/encryptionCertificate.xsdconfig
-                                        </xmlConfig>
-                                        <xmlConfig 
implementation="java.io.File">
-                                            
${basedir}/../../src/ooxml/resources/org/apache/poi/poifs/crypt/encryptionInfo.xsdconfig
-                                        </xmlConfig>
-                                        <xmlConfig 
implementation="java.io.File">
-                                            
${basedir}/../../src/ooxml/resources/org/apache/poi/poifs/crypt/encryptionPassword.xsdconfig
-                                        </xmlConfig>
-                                        <xmlConfig 
implementation="java.io.File">
-                                            
${basedir}/../../src/ooxml/resources/org/apache/poi/schemas/ooxmlSchemas.xsdconfig
-                                        </xmlConfig>
-                                    </xmlConfigs>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
-
-                    <plugin>
-                        <artifactId>maven-antrun-plugin</artifactId>
-                        <version>${maven.plugin.antrun.version}</version>
-                        <executions>
-                            <execution>
-                                <id>copy-xmltype-and-xsdconfig</id>
-                                <phase>generate-sources</phase>
-                                <goals>
-                                    <goal>run</goal>
-                                </goals>
-                                <configuration>
-                                    <target>
-                                        <copy 
todir="${basedir}/target/schemas">
-                                            <fileset 
dir="${basedir}/../../src/ooxml/resources/org/apache/poi/schemas" 
excludes="XAdES*.xsd"/>
-                                        </copy>
-                                    </target>
-                                </configuration>
-                            </execution>
-                            <execution>
-                                <id>replace-xmltypeloader</id>
-                                <phase>process-sources</phase>
-                                <goals>
-                                    <goal>run</goal>
-                                </goals>
-                                <configuration>
-                                    <target>
-                                        <!-- the space between "public  
static" is on purpose to prevent double execution -->
-                                        <property name="loaderMethod"><![CDATA[
-        private static 
java.lang.ref.SoftReference<org.apache.xmlbeans.SchemaTypeLoader> typeLoader;
-
-        private static synchronized org.apache.xmlbeans.SchemaTypeLoader 
getTypeLoader() {
-            org.apache.xmlbeans.SchemaTypeLoader stl = (typeLoader == null) ? 
null : typeLoader.get();
-            if (stl == null) {
-                stl = 
org.apache.xmlbeans.XmlBeans.typeLoaderForClassLoader(\2.class.getClassLoader());
-                typeLoader = new java.lang.ref.SoftReference(stl);
-            }
-            return stl;
-        }
-
-        public  static \2 newInstance\(\) \{]]></property>
-
-                                        <fileset id="xsrc" 
dir="${basedir}/target/generated-sources/xmlbeans" includes="**/*.java" 
excludes="**/impl/**"/>
-
-                                        <replaceregexp byline="true"
-                                                       match="(\s*)public 
static ([^ ]+) newInstance\(\) \{"
-                                                       
replace="${loaderMethod}">
-                                            <fileset refid="xsrc"/>
-                                        </replaceregexp>
-
-                                        <replace>
-                                            <fileset refid="xsrc"/>
-                                            
<replacetoken>org.apache.xmlbeans.XmlBeans.getContextTypeLoader
-                                            </replacetoken>
-                                            
<replacevalue>getTypeLoader</replacevalue>
-                                        </replace>
-
-                                        <!-- remove deprecated warnings, as we 
prefer the array methods - see #56854 -->
-                                        <replace>
-                                            <fileset refid="xsrc"/>
-                                            <replacetoken><![CDATA[     * 
@deprecated
-]]></replacetoken>
-                                        </replace>
-                                    </target>
-                                </configuration>
-                            </execution>
-                            <execution>
-                                <id>remove-xmltypeloader-from-schema-jar</id>
-                                <phase>prepare-package</phase>
-                                <goals>
-                                    <goal>run</goal>
-                                </goals>
-                                <configuration>
-                                    <target>
-                                        <touch 
file="${basedir}/target/generated-sources/xmlbeans/.staleFlag"/>
-                                        <delete 
dir="${basedir}/target/classes/org/apache"/>
-                                    </target>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-
-            <dependencies>
-                <dependency>
-                    <groupId>org.apache.xmlbeans</groupId>
-                    <artifactId>xmlbeans</artifactId>
-                    <version>${xmlbeans.version}</version>
-                </dependency>
-            </dependencies>
-        </profile>
     </profiles>
 </project>

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?rev=1882792&r1=1882791&r2=1882792&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java 
(original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Fri Oct 
23 22:30:33 2020
@@ -134,6 +134,8 @@ public final class TestBugs extends Base
             }
             SIMPLE_REFS.put(fileName, 
wb.getCreationHelper().createFormulaEvaluator());
         }
+
+        LocaleUtil.setUserLocale(Locale.US);
     }
 
     @AfterClass

Modified: 
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java?rev=1882792&r1=1882791&r2=1882792&view=diff
==============================================================================
--- 
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java 
(original)
+++ 
poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java 
Fri Oct 23 22:30:33 2020
@@ -17,18 +17,20 @@
 
 package org.apache.poi.ss.formula.functions;
 
+import static org.junit.Assert.assertEquals;
+
+import java.util.Locale;
+
 import org.apache.poi.ss.formula.eval.BlankEval;
 import org.apache.poi.ss.formula.eval.ErrorEval;
 import org.apache.poi.ss.formula.eval.NumberEval;
 import org.apache.poi.ss.formula.eval.StringEval;
 import org.apache.poi.ss.formula.eval.ValueEval;
 import org.apache.poi.util.LocaleUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.util.Locale;
-
-import static org.junit.Assert.assertEquals;
-
 /**
  * Tests for Excel function DATEVALUE()
  *
@@ -36,6 +38,16 @@ import static org.junit.Assert.assertEqu
  */
 public final class TestDateValue {
 
+    @BeforeClass
+    public static void init() {
+        LocaleUtil.setUserLocale(Locale.US);
+    }
+
+    @AfterClass
+    public static void clear() {
+        LocaleUtil.setUserLocale(null);
+    }
+
     @Test
     public void testDateValue() {
         confirmDateValue(new StringEval("2020-02-01"), 43862);
@@ -56,18 +68,13 @@ public final class TestDateValue {
 
         confirmDateValueError(new StringEval("non-date text"));
 
-        LocaleUtil.setUserLocale(Locale.ENGLISH);
-        try {
-            // // EXCEL
-            confirmDateValue(new StringEval("8/22/2011"), 40777); // Serial 
number of a date entered as text.
-            confirmDateValue(new StringEval("22-MAY-2011"), 40685); // Serial 
number of a date entered as text.
-            confirmDateValue(new StringEval("2011/02/23"), 40597); // Serial 
number of a date entered as text.
-
-            // LibreOffice compatibility
-            confirmDateValue(new StringEval("1954-07-20"), 19925);
-        } finally {
-            LocaleUtil.setUserLocale(null);
-        }
+        // // EXCEL
+        confirmDateValue(new StringEval("8/22/2011"), 40777); // Serial number 
of a date entered as text.
+        confirmDateValue(new StringEval("22-MAY-2011"), 40685); // Serial 
number of a date entered as text.
+        confirmDateValue(new StringEval("2011/02/23"), 40597); // Serial 
number of a date entered as text.
+
+        // LibreOffice compatibility
+        confirmDateValue(new StringEval("1954-07-20"), 19925);
     }
 
     private ValueEval invokeDateValue(ValueEval text) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to