From d4c9e0206ab971bf2018227e139536aa442eb34f Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Mon, 17 Jul 2017 11:36:32 +0000 Subject: [PATCH] fix tests broken by
doc changes git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1802131 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java | 3 +-- .../poi/xssf/util/EvilUnclosedBRFixingInputStream.java | 2 +- .../org/apache/poi/xssf/usermodel/TestXSSFBugs.java | 2 +- .../org/apache/poi/xssf/usermodel/TestXSSFVMLDrawing.java | 2 +- .../poi/xssf/util/TestEvilUnclosedBRFixingInputStream.java | 6 +++--- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java index b6874a481..43c38bce5 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java @@ -120,7 +120,6 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart { read(getPackagePart().getInputStream()); } - @SuppressWarnings("resource") protected void read(InputStream is) throws IOException, XmlException { Document doc; try { @@ -130,7 +129,7 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart { * The result is that they contain things like >br<, which breaks the XML parsing. * This very sick InputStream wrapper attempts to spot these go past, and fix them. */ - doc = DocumentHelper.readDocument(new ReplacingInputStream(is, "
", "
")); + doc = DocumentHelper.readDocument(new ReplacingInputStream(is, "
", "
")); } catch (SAXException e) { throw new XmlException(e.getMessage(), e); } diff --git a/src/ooxml/java/org/apache/poi/xssf/util/EvilUnclosedBRFixingInputStream.java b/src/ooxml/java/org/apache/poi/xssf/util/EvilUnclosedBRFixingInputStream.java index 65401148e..0ef1aeeb5 100644 --- a/src/ooxml/java/org/apache/poi/xssf/util/EvilUnclosedBRFixingInputStream.java +++ b/src/ooxml/java/org/apache/poi/xssf/util/EvilUnclosedBRFixingInputStream.java @@ -41,6 +41,6 @@ import org.apache.poi.util.ReplacingInputStream; @Internal public class EvilUnclosedBRFixingInputStream extends ReplacingInputStream { public EvilUnclosedBRFixingInputStream(InputStream source) { - super(source, "
", "
"); + super(source, "
", "
"); } } diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java index cc38582ab..01e3b9280 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java @@ -226,7 +226,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { * Excel will sometimes write a button with a textbox * containing >br< (not closed!). * Clearly Excel shouldn't do this, but test that we can - * read the file despite the naughtyness + * read the file despite the naughtiness */ @Test public void bug49020() throws IOException { diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFVMLDrawing.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFVMLDrawing.java index 477f15919..b8dbd36a7 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFVMLDrawing.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFVMLDrawing.java @@ -174,7 +174,7 @@ public class TestXSSFVMLDrawing { } finally { stream.close(); } - Pattern p = Pattern.compile("
"); + Pattern p = Pattern.compile("
"); int count = 0; for (XmlObject xo : vml.getItems()) { String split[] = p.split(xo.toString()); diff --git a/src/ooxml/testcases/org/apache/poi/xssf/util/TestEvilUnclosedBRFixingInputStream.java b/src/ooxml/testcases/org/apache/poi/xssf/util/TestEvilUnclosedBRFixingInputStream.java index 654bbb1d4..d9010fbbc 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/util/TestEvilUnclosedBRFixingInputStream.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/util/TestEvilUnclosedBRFixingInputStream.java @@ -32,7 +32,7 @@ public final class TestEvilUnclosedBRFixingInputStream { static class EvilUnclosedBRFixingInputStream extends ReplacingInputStream { public EvilUnclosedBRFixingInputStream(byte[] source) { - super(new ByteArrayInputStream(source), "
", "
"); + super(new ByteArrayInputStream(source), "
", "
"); } } @@ -49,7 +49,7 @@ public final class TestEvilUnclosedBRFixingInputStream { @Test public void testProblem() throws IOException { byte[] orig = getBytes("

Hello
There!
Tags!

"); - byte[] fixed = getBytes("

Hello
There!
Tags!

"); + byte[] fixed = getBytes("

Hello
There!
Tags!

"); EvilUnclosedBRFixingInputStream inp = new EvilUnclosedBRFixingInputStream(orig); @@ -63,7 +63,7 @@ public final class TestEvilUnclosedBRFixingInputStream { @Test public void testBufferSize() throws IOException { byte[] orig = getBytes("

Hello

There!
Tags!

"); - byte[] fixed = getBytes("

Hello

There!
Tags!

"); + byte[] fixed = getBytes("

Hello

There!
Tags!

"); // Vary the buffer size, so that we can end up with the br in the // overflow or only part in the buffer