Skip to content

Commit 5231ede

Browse files
committed
PDFBOX-2941: remove empty lines, set indent to 2
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1930288 13f79535-47bb-0310-9956-ffa450edef68
1 parent e526d22 commit 5231ede

File tree

1 file changed

+3
-2
lines changed
  • debugger/src/main/java/org/apache/pdfbox/debugger/streampane

1 file changed

+3
-2
lines changed

debugger/src/main/java/org/apache/pdfbox/debugger/streampane/StreamPane.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,12 +383,13 @@ private StyledDocument getXMLDocument(InputStream inputStream)
383383
transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
384384
Transformer transformer = transformerFactory.newTransformer();
385385
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
386-
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "1");
386+
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
387387
StringWriter sw = new StringWriter();
388388
StreamResult result = new StreamResult(sw);
389389
DOMSource source = new DOMSource(doc);
390390
transformer.transform(source, result);
391-
docu.insertString(0, sw.toString(), null);
391+
// replaceAll because of JDK-8262285. Alternatively pass an XSLT to newTransformer()
392+
docu.insertString(0, sw.toString().replaceAll("(\\r\\n|\\r|\\n) +(\\r\\n|\\r|\\n)","\n"), null);
392393
}
393394
catch (IOException | TransformerFactoryConfigurationError | IllegalArgumentException |
394395
TransformerException | BadLocationException ex)

0 commit comments

Comments
 (0)