From 264adcb02529f4c1581ab5ca2b1240ba9a8d468c Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Sun, 20 Aug 2017 19:18:48 +0000 Subject: [PATCH 1/5] prepare for 3.18-beta1 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1805582 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 2 +- sonar/examples/pom.xml | 2 +- sonar/excelant/pom.xml | 2 +- sonar/main/pom.xml | 2 +- sonar/ooxml-schema-encryption/pom.xml | 2 +- sonar/ooxml-schema-security/pom.xml | 2 +- sonar/ooxml-schema/pom.xml | 2 +- sonar/ooxml/pom.xml | 2 +- sonar/pom.xml | 2 +- sonar/scratchpad/pom.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build.xml b/build.xml index 72be9b4d2d..fa60c524ec 100644 --- a/build.xml +++ b/build.xml @@ -40,7 +40,7 @@ under the License. The Apache POI project Ant build. - + diff --git a/sonar/examples/pom.xml b/sonar/examples/pom.xml index 914b2c661d..955a11759b 100644 --- a/sonar/examples/pom.xml +++ b/sonar/examples/pom.xml @@ -6,7 +6,7 @@ org.apache.poi poi-parent - 3.17-beta2-SNAPSHOT + 3.18-beta1-SNAPSHOT poi-examples jar diff --git a/sonar/excelant/pom.xml b/sonar/excelant/pom.xml index 90856ac32a..da39b407cf 100644 --- a/sonar/excelant/pom.xml +++ b/sonar/excelant/pom.xml @@ -6,7 +6,7 @@ org.apache.poi poi-parent - 3.17-beta2-SNAPSHOT + 3.18-beta1-SNAPSHOT poi-excelant jar diff --git a/sonar/main/pom.xml b/sonar/main/pom.xml index 7ee617ba49..d0cee4498b 100644 --- a/sonar/main/pom.xml +++ b/sonar/main/pom.xml @@ -6,7 +6,7 @@ org.apache.poi poi-parent - 3.17-beta2-SNAPSHOT + 3.18-beta1-SNAPSHOT poi-main jar diff --git a/sonar/ooxml-schema-encryption/pom.xml b/sonar/ooxml-schema-encryption/pom.xml index 111a782503..f884902040 100644 --- a/sonar/ooxml-schema-encryption/pom.xml +++ b/sonar/ooxml-schema-encryption/pom.xml @@ -6,7 +6,7 @@ org.apache.poi poi-parent - 3.17-beta2-SNAPSHOT + 3.18-beta1-SNAPSHOT .. poi-ooxml-schema-encryption diff --git a/sonar/ooxml-schema-security/pom.xml b/sonar/ooxml-schema-security/pom.xml index 49ada48a53..ac7e4fa560 100644 --- a/sonar/ooxml-schema-security/pom.xml +++ b/sonar/ooxml-schema-security/pom.xml @@ -6,7 +6,7 @@ org.apache.poi poi-parent - 3.17-beta2-SNAPSHOT + 3.18-beta1-SNAPSHOT .. poi-ooxml-schema-security diff --git a/sonar/ooxml-schema/pom.xml b/sonar/ooxml-schema/pom.xml index 25b1b4b516..24221f8c9c 100644 --- a/sonar/ooxml-schema/pom.xml +++ b/sonar/ooxml-schema/pom.xml @@ -6,7 +6,7 @@ org.apache.poi poi-parent - 3.17-beta2-SNAPSHOT + 3.18-beta1-SNAPSHOT .. poi-ooxml-schema diff --git a/sonar/ooxml/pom.xml b/sonar/ooxml/pom.xml index 31f035ecb0..bcbe99520f 100644 --- a/sonar/ooxml/pom.xml +++ b/sonar/ooxml/pom.xml @@ -6,7 +6,7 @@ org.apache.poi poi-parent - 3.17-beta2-SNAPSHOT + 3.18-beta1-SNAPSHOT poi-ooxml jar diff --git a/sonar/pom.xml b/sonar/pom.xml index 3e9314cb6a..0e141f749e 100644 --- a/sonar/pom.xml +++ b/sonar/pom.xml @@ -3,7 +3,7 @@ org.apache.poi poi-parent pom - 3.17-beta2-SNAPSHOT + 3.18-beta1-SNAPSHOT Apache POI - the Java API for Microsoft Documents Maven build of Apache POI for Sonar checks http://poi.apache.org/ diff --git a/sonar/scratchpad/pom.xml b/sonar/scratchpad/pom.xml index f1b8485eaf..12bc99556b 100644 --- a/sonar/scratchpad/pom.xml +++ b/sonar/scratchpad/pom.xml @@ -6,7 +6,7 @@ org.apache.poi poi-parent - 3.17-beta2-SNAPSHOT + 3.18-beta1-SNAPSHOT poi-scratchpad jar From 225285edc6363d6a7c239b3db98e76867acf7770 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Thu, 24 Aug 2017 19:46:39 +0000 Subject: [PATCH 2/5] Revert performance tuning done via Bug 61350 as it lead to problems when running multi-threaded large regression tests. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1806077 13f79535-47bb-0310-9956-ffa450edef68 --- src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java b/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java index b518909088..911eef63d8 100644 --- a/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java +++ b/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java @@ -71,7 +71,9 @@ public class POIXMLTypeLoader { // DEFAULT_XML_OPTIONS.setLoadEntityBytesLimit(4096); // POI is not thread-safe - so we can switch to unsynchronized xmlbeans mode - see #61350 - DEFAULT_XML_OPTIONS.setUnsynchronized(); + // Update: disabled again for now as it caused strange NPEs and other problems + // when reading properties in separate workbooks in multiple threads + // DEFAULT_XML_OPTIONS.setUnsynchronized(); Map map = new HashMap(); map.put("http://schemas.openxmlformats.org/drawingml/2006/main", "a"); From df06e47470744acf3b851e9dfa3469f70fd1fb02 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Fri, 25 Aug 2017 11:51:18 +0000 Subject: [PATCH 3/5] Verify that bug 61294 is fixed now, add some more coverage for IOUtils in general git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1806162 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/util/IOUtils.java | 10 ++-- .../org/apache/poi/util/TestIOUtils.java | 59 ++++++++++++++++++- 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/src/java/org/apache/poi/util/IOUtils.java b/src/java/org/apache/poi/util/IOUtils.java index b256591fa0..c2be578638 100644 --- a/src/java/org/apache/poi/util/IOUtils.java +++ b/src/java/org/apache/poi/util/IOUtils.java @@ -206,7 +206,7 @@ public final class IOUtils { * * @param doc a writeable document to write to the output stream * @param out the output stream that the document is written to - * @throws IOException + * @throws IOException thrown on errors writing to the stream */ public static void write(POIDocument doc, OutputStream out) throws IOException { try { @@ -225,7 +225,7 @@ public final class IOUtils { * * @param doc a writeable document to write to the output stream * @param out the output stream that the document is written to - * @throws IOException + * @throws IOException thrown on errors writing to the stream */ public static void write(Workbook doc, OutputStream out) throws IOException { try { @@ -245,7 +245,7 @@ public final class IOUtils { * * @param doc a writeable and closeable document to write to the output stream, then close * @param out the output stream that the document is written to - * @throws IOException + * @throws IOException thrown on errors writing to the stream */ public static void writeAndClose(POIDocument doc, OutputStream out) throws IOException { try { @@ -264,7 +264,7 @@ public final class IOUtils { * * @param doc a writeable and closeable document to write to the output file, then close * @param out the output file that the document is written to - * @throws IOException + * @throws IOException thrown on errors writing to the stream */ public static void writeAndClose(POIDocument doc, File out) throws IOException { try { @@ -282,7 +282,7 @@ public final class IOUtils { * This function exists for Java 6 code. * * @param doc a writeable document to write in-place - * @throws IOException + * @throws IOException thrown on errors writing to the file */ public static void writeAndClose(POIDocument doc) throws IOException { try { diff --git a/src/testcases/org/apache/poi/util/TestIOUtils.java b/src/testcases/org/apache/poi/util/TestIOUtils.java index 825e35aa8b..4a08a32e07 100644 --- a/src/testcases/org/apache/poi/util/TestIOUtils.java +++ b/src/testcases/org/apache/poi/util/TestIOUtils.java @@ -17,6 +17,7 @@ package org.apache.poi.util; +import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import java.io.ByteArrayInputStream; @@ -27,8 +28,11 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.PushbackInputStream; +import java.nio.ByteBuffer; import java.util.Random; +import org.apache.poi.EmptyFileException; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -55,9 +59,57 @@ public final class TestIOUtils { @AfterClass public static void tearDown() throws IOException { + //noinspection ResultOfMethodCallIgnored TMP.delete(); } + @Test + public void testPeekFirst8Bytes() throws Exception { + assertArrayEquals("01234567".getBytes("UTF-8"), + IOUtils.peekFirst8Bytes(new ByteArrayInputStream("0123456789".getBytes("UTF-8")))); + } + + @Test + public void testPeekFirst8BytesWithPushbackInputStream() throws Exception { + assertArrayEquals("01234567".getBytes("UTF-8"), + IOUtils.peekFirst8Bytes(new PushbackInputStream(new ByteArrayInputStream("0123456789".getBytes("UTF-8")), 8))); + } + + @Test + public void testPeekFirst8BytesTooLessAvailable() throws Exception { + assertArrayEquals(new byte[] { 1, 2, 3, 0, 0, 0, 0, 0}, + IOUtils.peekFirst8Bytes(new ByteArrayInputStream(new byte[] { 1, 2, 3}))); + } + + @Test(expected = EmptyFileException.class) + public void testPeekFirst8BytesEmpty() throws Exception { + IOUtils.peekFirst8Bytes(new ByteArrayInputStream(new byte[] {})); + } + + @Test + public void testToByteArray() throws Exception { + assertArrayEquals(new byte[] { 1, 2, 3}, + IOUtils.toByteArray(new ByteArrayInputStream(new byte[] { 1, 2, 3}))); + } + + @Test(expected = IOException.class) + public void testToByteArrayToSmall() throws Exception { + assertArrayEquals(new byte[] { 1, 2, 3}, + IOUtils.toByteArray(new ByteArrayInputStream(new byte[] { 1, 2, 3}), 10)); + } + + @Test + public void testToByteArrayByteBuffer() throws Exception { + assertArrayEquals(new byte[] { 1, 2, 3}, + IOUtils.toByteArray(ByteBuffer.wrap(new byte[]{1, 2, 3}), 10)); + } + + @Test + public void testToByteArrayByteBufferToSmall() throws Exception { + assertArrayEquals(new byte[] { 1, 2, 3, 4, 5, 6, 7}, + IOUtils.toByteArray(ByteBuffer.wrap(new byte[]{1, 2, 3, 4, 5, 6, 7}), 3)); + } + @Test public void testSkipFully() throws IOException { InputStream is = new FileInputStream(TMP); @@ -90,6 +142,11 @@ public final class TestIOUtils { assertEquals("length: "+LENGTH, LENGTH, skipped); } + @Test + public void testSkipFullyBug61294() throws IOException { + IOUtils.skipFully(new ByteArrayInputStream(new byte[0]), 1); + } + @Test public void testZeroByte() throws IOException { long skipped = IOUtils.skipFully((new ByteArrayInputStream(new byte[0])), 100); @@ -105,7 +162,7 @@ public final class TestIOUtils { @Test(expected = IllegalArgumentException.class) public void testSkipNegative() throws IOException { InputStream is = new FileInputStream(TMP); - long skipped = IOUtils.skipFully(is, -1); + IOUtils.skipFully(is, -1); } @Test From 4327c38fc05deb1c73aebc413c1dfabc41084a0b Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Mon, 28 Aug 2017 20:41:16 +0000 Subject: [PATCH 4/5] sha512 checksums aren't yet supported by Nexus git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1806505 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build.xml b/build.xml index fa60c524ec..f6132e805d 100644 --- a/build.xml +++ b/build.xml @@ -2408,7 +2408,8 @@ under the License. - + + @@ -2434,10 +2435,11 @@ under the License. ${lastUpdated} ]]> - - + + + From 806c9610d44d4bd57766061e57e5ae158d1ebc30 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Mon, 28 Aug 2017 20:52:23 +0000 Subject: [PATCH 5/5] release prepare for 3.17 - updating build.xml and status.xml git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1806507 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.xml b/build.xml index f6132e805d..d6ff129997 100644 --- a/build.xml +++ b/build.xml @@ -40,7 +40,7 @@ under the License. The Apache POI project Ant build. - +