We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 72b6ee4 + f64a309 commit f00445dCopy full SHA for f00445d
src/main/java/net/revelc/code/formatter/xml/lib/XmlDocumentFormatter.java
@@ -97,10 +97,9 @@ public String format(String documentText) {
97
validateWellFormedness(documentText);
98
}
99
100
- Reader reader = new StringReader(documentText);
101
FormatState state = new FormatState();
102
103
- try {
+ try (Reader reader = new StringReader(documentText)) {
104
while (true) {
105
reader.mark(1);
106
int intChar = reader.read();
@@ -111,7 +110,6 @@ public String format(String documentText) {
111
110
112
copyNode(reader, state);
113
114
- reader.close();
115
} catch (IOException e) {
116
logger.error("{}", e.getMessage());
117
logger.debug("", e);
0 commit comments