diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2020-10-23 22:30:33 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2020-10-23 22:30:33 +0000 |
commit | d708b9da00cb25b169f6f2bc43d44a00e520090f (patch) | |
tree | 335265aad694ad2abdec66737ca338670286eed9 | |
parent | a2dcb10f67c816acd1ab9ed779dae12ad7536603 (diff) | |
download | poi-d708b9da00cb25b169f6f2bc43d44a00e520090f.tar.gz poi-d708b9da00cb25b169f6f2bc43d44a00e520090f.zip |
try to fix sonar build
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1882792 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | sonar/integration-test/pom.xml | 11 | ||||
-rw-r--r-- | sonar/main/pom.xml | 52 | ||||
-rw-r--r-- | sonar/ooxml-schema-encryption/pom.xml | 55 | ||||
-rw-r--r-- | sonar/ooxml-schema-encryption/xmlbeans.marker | 1 | ||||
-rw-r--r-- | sonar/ooxml-schema-security/pom.xml | 108 | ||||
-rw-r--r-- | sonar/ooxml-schema-security/xmlbeans.marker | 1 | ||||
-rw-r--r-- | sonar/ooxml-schema/pom.xml | 117 | ||||
-rw-r--r-- | sonar/ooxml/pom.xml | 17 | ||||
-rw-r--r-- | sonar/pom.xml | 148 | ||||
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java | 2 | ||||
-rw-r--r-- | src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java | 39 |
11 files changed, 150 insertions, 401 deletions
diff --git a/sonar/integration-test/pom.xml b/sonar/integration-test/pom.xml index 668c6469b3..d28861c891 100644 --- a/sonar/integration-test/pom.xml +++ b/sonar/integration-test/pom.xml @@ -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> diff --git a/sonar/main/pom.xml b/sonar/main/pom.xml index 00c49dae1b..b2a7da5992 100644 --- a/sonar/main/pom.xml +++ b/sonar/main/pom.xml @@ -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> diff --git a/sonar/ooxml-schema-encryption/pom.xml b/sonar/ooxml-schema-encryption/pom.xml deleted file mode 100644 index 40a114ecc9..0000000000 --- a/sonar/ooxml-schema-encryption/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 - http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.poi</groupId> - <artifactId>poi-parent</artifactId> - <version>5.0.0-SNAPSHOT</version> - <relativePath>..</relativePath> - </parent> - <artifactId>poi-ooxml-schema-encryption</artifactId> - <packaging>jar</packaging> - - <name>Apache POI - Openxmlformats Encryption Schema package</name> - - <properties> - <!-- see http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus for details of this property --> - <sonar.exclusions>target/generated-sources/*</sonar.exclusions> - </properties> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <version>${maven.plugin.antrun.version}</version> - <executions> - <execution> - <id>unzip-schema</id> - <phase>generate-sources</phase> - <goals> - <goal>run</goal> - </goals> - <configuration> - <target> - <copy todir="target/schemas"> - <fileset dir="../../src/ooxml/resources/org/apache/poi/poifs/crypt" includes="encryption*.*"/> - </copy> - </target> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <dependencies> - <dependency> - <groupId>org.apache.xmlbeans</groupId> - <artifactId>xmlbeans</artifactId> - <version>${xmlbeans.version}</version> - </dependency> - </dependencies> -</project> diff --git a/sonar/ooxml-schema-encryption/xmlbeans.marker b/sonar/ooxml-schema-encryption/xmlbeans.marker deleted file mode 100644 index 2744493ace..0000000000 --- a/sonar/ooxml-schema-encryption/xmlbeans.marker +++ /dev/null @@ -1 +0,0 @@ -This purpose of this marker file is solely to activate the xmlbeans maven profile.
\ No newline at end of file diff --git a/sonar/ooxml-schema-security/pom.xml b/sonar/ooxml-schema-security/pom.xml deleted file mode 100644 index 493dd6429b..0000000000 --- a/sonar/ooxml-schema-security/pom.xml +++ /dev/null @@ -1,108 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 - http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.poi</groupId> - <artifactId>poi-parent</artifactId> - <version>5.0.0-SNAPSHOT</version> - <relativePath>..</relativePath> - </parent> - <artifactId>poi-ooxml-schema-security</artifactId> - <packaging>jar</packaging> - - <name>Apache POI - Openxmlformats Security-Schema package</name> - - <properties> - <!-- 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.noUpa>true</xmlbeans.noUpa> - <xmlbeans.noPvr>true</xmlbeans.noPvr> - </properties> - <build> - <plugins> - <!-- Download and unpack the OfficeOpenXML Schema and use xmlbeans to create classes from the XSDs --> - <!-- use maven plugin instead of ant tasks get because of caching feature ... --> - <plugin> - <groupId>com.googlecode.maven-download-plugin</groupId> - <artifactId>download-maven-plugin</artifactId> - <version>${maven.plugin.download.version}</version> - <executions> - <execution> - <id>install-xsds-part-1</id> - <phase>generate-sources</phase> - <goals><goal>wget</goal></goals> - <configuration> - <url>https://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%201st%20edition%20Part%202%20(PDF).zip</url> - <unpack>true</unpack> - <md5>c8f0eac388691d5be0d1647146400a10</md5> - </configuration> - </execution> - <execution> - <id>install-xsds-part-2</id> - <phase>generate-sources</phase> - <goals><goal>wget</goal></goals> - <configuration> - <outputDirectory>target/schemas</outputDirectory> - <url>https://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd</url> - </configuration> - </execution> - </executions> - </plugin> - - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <version>${maven.plugin.antrun.version}</version> - <executions> - <execution> - <id>unzip-schema</id> - <phase>generate-sources</phase> - <goals> - <goal>run</goal> - </goals> - <configuration> - <target> - <echo message="unzip schemas" /> - <unzip src="target/OpenPackagingConventions-XMLSchema.zip" dest="target/schemas/"> - <patternset> - <include name="opc-digSig.xsd"/> - <include name="opc-relationships.xsd"/> - </patternset> - </unzip> - <copy todir="target/schemas"> - <fileset dir="../../src/ooxml/resources/org/apache/poi"> - <include name="poifs/crypt/signatureInfo.xsd"/> - <include name="schemas/XAdES*.xsd"/> - </fileset> - </copy> - </target> - </configuration> - </execution> - </executions> - </plugin> - - </plugins> - </build> - - <dependencies> - <dependency> - <groupId>org.apache.xmlbeans</groupId> - <artifactId>xmlbeans</artifactId> - <version>${xmlbeans.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>poi-main</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>poi-scratchpad</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> -</project> diff --git a/sonar/ooxml-schema-security/xmlbeans.marker b/sonar/ooxml-schema-security/xmlbeans.marker deleted file mode 100644 index 2744493ace..0000000000 --- a/sonar/ooxml-schema-security/xmlbeans.marker +++ /dev/null @@ -1 +0,0 @@ -This purpose of this marker file is solely to activate the xmlbeans maven profile.
\ No newline at end of file diff --git a/sonar/ooxml-schema/pom.xml b/sonar/ooxml-schema/pom.xml index 184e7ebded..b65bf6168a 100644 --- a/sonar/ooxml-schema/pom.xml +++ b/sonar/ooxml-schema/pom.xml @@ -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> diff --git a/sonar/ooxml/pom.xml b/sonar/ooxml/pom.xml index 17c383eb1e..dd908ed814 100644 --- a/sonar/ooxml/pom.xml +++ b/sonar/ooxml/pom.xml @@ -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> @@ -187,6 +177,13 @@ </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> <artifactId>batik-all</artifactId> diff --git a/sonar/pom.xml b/sonar/pom.xml index 35de60c29f..62301c2a46 100644 --- a/sonar/pom.xml +++ b/sonar/pom.xml @@ -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> diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index 446d9b1d0e..129a74fd96 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -134,6 +134,8 @@ public final class TestBugs extends BaseTestBugzillaIssues { } SIMPLE_REFS.put(fileName, wb.getCreationHelper().createFormulaEvaluator()); } + + LocaleUtil.setUserLocale(Locale.US); } @AfterClass diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java b/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java index 1598c7a8f0..edaa5da042 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java @@ -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.assertEquals; */ 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) { |