Skip to content

Commit 44dc4f9

Browse files
committed
fixup! Forced use of Woodstox parser for FormatCommand and fixed bug
1 parent 6c76a1a commit 44dc4f9

File tree

1 file changed

+3
-6
lines changed
  • plugins/codemodder-plugin-maven/src/main/java/io/codemodder/plugins/maven/operator

1 file changed

+3
-6
lines changed

plugins/codemodder-plugin-maven/src/main/java/io/codemodder/plugins/maven/operator/FormatCommand.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import com.ctc.wstx.evt.CompactStartElement;
66
import com.ctc.wstx.stax.WstxInputFactory;
7+
import com.ctc.wstx.stax.WstxOutputFactory;
78
import java.io.ByteArrayInputStream;
89
import java.io.IOException;
910
import java.io.InputStream;
@@ -43,7 +44,7 @@ class FormatCommand extends AbstractCommand {
4344
private XMLInputFactory inputFactory = WstxInputFactory.newInstance();
4445

4546
/** StAX OutputFactory */
46-
private XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
47+
private XMLOutputFactory outputFactory = WstxOutputFactory.newInstance();
4748

4849
private List<MatchData> singleElementsWithAttributes = new ArrayList<>();
4950

@@ -272,10 +273,6 @@ private void parseXmlAndCharset(POMDocument pomFile) throws XMLStreamException,
272273
int elementStart = 0;
273274
List<XMLEvent> prevEvents = new ArrayList<>();
274275

275-
System.out.println("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
276-
System.out.println(inputFactory.getClass());
277-
System.out.println(eventReader.getClass());
278-
System.out.println("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
279276
while (eventReader.hasNext()) {
280277
XMLEvent event = eventReader.nextEvent();
281278

@@ -331,7 +328,7 @@ private void parseXmlAndCharset(POMDocument pomFile) throws XMLStreamException,
331328
new String(pomFile.getOriginalPom(), pomFile.getCharset());
332329

333330
String untrimmedOriginalContent = "";
334-
// is self closing element, tag is contained within the offset of the next element
331+
// is self-closing element, tag is contained within the offset of the next element
335332
if (prevEvents.get(prevEvents.size() - 1) instanceof CompactStartElement) {
336333
untrimmedOriginalContent =
337334
originalPomCharsetString.substring(

0 commit comments

Comments
 (0)