fix tests broken by <br/> doc changes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1802131 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
810d03f499
commit
d4c9e0206a
@ -120,7 +120,6 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart {
|
|||||||
read(getPackagePart().getInputStream());
|
read(getPackagePart().getInputStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("resource")
|
|
||||||
protected void read(InputStream is) throws IOException, XmlException {
|
protected void read(InputStream is) throws IOException, XmlException {
|
||||||
Document doc;
|
Document doc;
|
||||||
try {
|
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.
|
* 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.
|
* 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) {
|
} catch (SAXException e) {
|
||||||
throw new XmlException(e.getMessage(), e);
|
throw new XmlException(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,6 @@ import org.apache.poi.util.ReplacingInputStream;
|
|||||||
@Internal
|
@Internal
|
||||||
public class EvilUnclosedBRFixingInputStream extends ReplacingInputStream {
|
public class EvilUnclosedBRFixingInputStream extends ReplacingInputStream {
|
||||||
public EvilUnclosedBRFixingInputStream(InputStream source) {
|
public EvilUnclosedBRFixingInputStream(InputStream source) {
|
||||||
super(source, "<br>", "<br>");
|
super(source, "<br>", "<br/>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
|||||||
* Excel will sometimes write a button with a textbox
|
* Excel will sometimes write a button with a textbox
|
||||||
* containing >br< (not closed!).
|
* containing >br< (not closed!).
|
||||||
* Clearly Excel shouldn't do this, but test that we can
|
* Clearly Excel shouldn't do this, but test that we can
|
||||||
* read the file despite the naughtyness
|
* read the file despite the naughtiness
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void bug49020() throws IOException {
|
public void bug49020() throws IOException {
|
||||||
|
@ -174,7 +174,7 @@ public class TestXSSFVMLDrawing {
|
|||||||
} finally {
|
} finally {
|
||||||
stream.close();
|
stream.close();
|
||||||
}
|
}
|
||||||
Pattern p = Pattern.compile("<br>");
|
Pattern p = Pattern.compile("<br/>");
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (XmlObject xo : vml.getItems()) {
|
for (XmlObject xo : vml.getItems()) {
|
||||||
String split[] = p.split(xo.toString());
|
String split[] = p.split(xo.toString());
|
||||||
|
@ -32,7 +32,7 @@ public final class TestEvilUnclosedBRFixingInputStream {
|
|||||||
|
|
||||||
static class EvilUnclosedBRFixingInputStream extends ReplacingInputStream {
|
static class EvilUnclosedBRFixingInputStream extends ReplacingInputStream {
|
||||||
public EvilUnclosedBRFixingInputStream(byte[] source) {
|
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
|
@Test
|
||||||
public void testProblem() throws IOException {
|
public void testProblem() throws IOException {
|
||||||
byte[] orig = getBytes("<p><div>Hello<br>There!</div> <div>Tags!</div></p>");
|
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);
|
EvilUnclosedBRFixingInputStream inp = new EvilUnclosedBRFixingInputStream(orig);
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ public final class TestEvilUnclosedBRFixingInputStream {
|
|||||||
@Test
|
@Test
|
||||||
public void testBufferSize() throws IOException {
|
public void testBufferSize() throws IOException {
|
||||||
byte[] orig = getBytes("<p><div>Hello<br> <br>There!</div> <div>Tags!<br><br></div></p>");
|
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
|
// Vary the buffer size, so that we can end up with the br in the
|
||||||
// overflow or only part in the buffer
|
// overflow or only part in the buffer
|
||||||
|
Loading…
Reference in New Issue
Block a user