(forwarded from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895899 )
Hi,
htmlcleaner's test suite fails with java9. The workaround is straightforward and pasted below altough I'm not sure if whitespace is important for htmlcleaner's output.
javax.xml.transform.Transformer changed behaviour with java9 in a way that makes its output indented with 4 spaces. This is not what the test suite expects. This patchs works around this problem.
--- a/src/test/java/org/htmlcleaner/AbstractHtmlCleanerTest.java
+++ b/src/test/java/org/htmlcleaner/AbstractHtmlCleanerTest.java
@@ -99,7 +99,7 @@ public abstract class AbstractHtmlCleanerTest {
Transformer transformer = tf.newTransformer();
transformer.transform(new DOMSource(document), new StreamResult(writer));
String actual = writer.getBuffer().toString();
- actual = actual.substring(actual.indexOf("\n")+7, actual.indexOf("\n"));
+ actual = actual.substring(actual.indexOf("\n")+7, actual.indexOf("")).trim();
assertEquals(expected, actual);
cleaner.getProperties().setOmitHtmlEnvelope(true);
}
Thanks niol! I've commited this change to trunk so it'll be in the next release. (The change doesn't affect the actual output, just unit testing.)