]> source.dussan.org Git - poi.git/commitdiff
fix tests broken by <br/> doc changes
authorPJ Fanning <fanningpj@apache.org>
Mon, 17 Jul 2017 11:36:32 +0000 (11:36 +0000)
committerPJ Fanning <fanningpj@apache.org>
Mon, 17 Jul 2017 11:36:32 +0000 (11:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1802131 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java
src/ooxml/java/org/apache/poi/xssf/util/EvilUnclosedBRFixingInputStream.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFVMLDrawing.java
src/ooxml/testcases/org/apache/poi/xssf/util/TestEvilUnclosedBRFixingInputStream.java

index b6874a481a489ecf01e84f32b86325b8baa237ce..43c38bce5b9794b103eed774eb9a095ca54d49a5 100644 (file)
@@ -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 &gt;br&lt;, 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, "<br>", "<br>"));
+            doc = DocumentHelper.readDocument(new ReplacingInputStream(is, "<br>", "<br/>"));
         } catch (SAXException e) {
             throw new XmlException(e.getMessage(), e);
         }
index 65401148e53e5c0c54c4c091b07a414e4e998ecd..0ef1aeeb5eaffc953ad9379c6a79453ad1e7a1ff 100644 (file)
@@ -41,6 +41,6 @@ import org.apache.poi.util.ReplacingInputStream;
 @Internal
 public class EvilUnclosedBRFixingInputStream extends ReplacingInputStream {
    public EvilUnclosedBRFixingInputStream(InputStream source) {
-      super(source, "<br>", "<br>");
+      super(source, "<br>", "<br/>");
    }
 }
index cc38582ab969ef24c844bf3ee5f243fd96a1dc5e..01e3b9280787b4e25e667d30844caafb05b1d235 100644 (file)
@@ -226,7 +226,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
      * Excel will sometimes write a button with a textbox
      * containing &gt;br&lt; (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 {
index 477f159193e2062770bfd5d046a543ad8ceae5fe..b8dbd36a712f94e9f25f10cb7b3d0b0ca160dfca 100644 (file)
@@ -174,7 +174,7 @@ public class TestXSSFVMLDrawing {
         } finally {
             stream.close();
         }
-        Pattern p = Pattern.compile("<br>");
+        Pattern p = Pattern.compile("<br/>");
         int count = 0;
         for (XmlObject xo : vml.getItems()) {
             String split[] = p.split(xo.toString());
index 654bbb1d42511b6044a2759338ce0d204b0238a4..d9010fbbc2ef50e072c6158f4b73a23dbfc645ff 100644 (file)
@@ -32,7 +32,7 @@ public final class TestEvilUnclosedBRFixingInputStream {
 
     static class EvilUnclosedBRFixingInputStream extends ReplacingInputStream {
         public EvilUnclosedBRFixingInputStream(byte[] source) {
-            super(new ByteArrayInputStream(source), "<br>", "<br>");
+            super(new ByteArrayInputStream(source), "<br>", "<br/>");
         }
     }
 
@@ -49,7 +49,7 @@ public final class TestEvilUnclosedBRFixingInputStream {
     @Test
     public void testProblem() throws IOException {
         byte[] orig = getBytes("<p><div>Hello<br>There!</div> <div>Tags!</div></p>");
-        byte[] fixed = getBytes("<p><div>Hello<br>There!</div> <div>Tags!</div></p>");
+        byte[] fixed = getBytes("<p><div>Hello<br/>There!</div> <div>Tags!</div></p>");
 
         EvilUnclosedBRFixingInputStream inp = new EvilUnclosedBRFixingInputStream(orig);
 
@@ -63,7 +63,7 @@ public final class TestEvilUnclosedBRFixingInputStream {
     @Test
     public void testBufferSize() throws IOException {
         byte[] orig = getBytes("<p><div>Hello<br> <br>There!</div> <div>Tags!<br><br></div></p>");
-        byte[] fixed = getBytes("<p><div>Hello<br> <br>There!</div> <div>Tags!<br><br></div></p>");
+        byte[] fixed = getBytes("<p><div>Hello<br/> <br/>There!</div> <div>Tags!<br/><br/></div></p>");
 
         // Vary the buffer size, so that we can end up with the br in the
         //  overflow or only part in the buffer