try to fix sonar build

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1882792 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2020-10-23 22:30:33 +00:00
parent a2dcb10f67
commit d708b9da00
11 changed files with 154 additions and 405 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -1 +0,0 @@
This purpose of this marker file is solely to activate the xmlbeans maven profile.

View File

@ -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>

View File

@ -1 +0,0 @@
This purpose of this marker file is solely to activate the xmlbeans maven profile.

View File

@ -18,27 +18,103 @@
<!-- 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.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<!-- 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>
@ -46,25 +122,16 @@
<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>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<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>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
<Automatic-Module-Name>org.apache.poi.ooxml.schemas</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -105,16 +105,6 @@
<artifactId>poi-ooxml-schema</artifactId>
<version>${project.version}</version>
</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>
@ -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>

View File

@ -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>

View File

@ -134,6 +134,8 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
SIMPLE_REFS.put(fileName, wb.getCreationHelper().createFormulaEvaluator());
}
LocaleUtil.setUserLocale(Locale.US);
}
@AfterClass

View File

@ -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,8 +68,6 @@ 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.
@ -65,9 +75,6 @@ public final class TestDateValue {
// LibreOffice compatibility
confirmDateValue(new StringEval("1954-07-20"), 19925);
} finally {
LocaleUtil.setUserLocale(null);
}
}
private ValueEval invokeDateValue(ValueEval text) {