You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2025/12/06 14:15:48 UTC
svn commit: r1930289 - pdfbox/branches/3.0/debugger/src/main/java/org/apache/pdfbox/debugger/streampane
Author: tilman
Date: Sat Dec 6 14:15:47 2025
New Revision: 1930289
Log:
PDFBOX-2941: remove empty lines, set indent to 2
Modified:
pdfbox/branches/3.0/debugger/src/main/java/org/apache/pdfbox/debugger/streampane/StreamPane.java
Modified: pdfbox/branches/3.0/debugger/src/main/java/org/apache/pdfbox/debugger/streampane/StreamPane.java
==============================================================================
--- pdfbox/branches/3.0/debugger/src/main/java/org/apache/pdfbox/debugger/streampane/StreamPane.java Sat Dec 6 14:15:43 2025 (r1930288)
+++ pdfbox/branches/3.0/debugger/src/main/java/org/apache/pdfbox/debugger/streampane/StreamPane.java Sat Dec 6 14:15:47 2025 (r1930289)
@@ -384,12 +384,13 @@ public class StreamPane implements Actio
transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "1");
+ transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
StringWriter sw = new StringWriter();
StreamResult result = new StreamResult(sw);
DOMSource source = new DOMSource(doc);
transformer.transform(source, result);
- docu.insertString(0, sw.toString(), null);
+ // replaceAll because of JDK-8262285. Alternatively pass an XSLT to newTransformer()
+ docu.insertString(0, sw.toString().replaceAll("(\\r\\n|\\r|\\n) +(\\r\\n|\\r|\\n)","\n"), null);
}
catch (IOException | TransformerFactoryConfigurationError | IllegalArgumentException |
TransformerException | BadLocationException ex)