Skip to content

Commit 955538f

Browse files
committed
Disabled faulty empty element format preservation from POM operator
1 parent 9e68b29 commit 955538f

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -508,21 +508,21 @@ private byte[] serializePomFile(POMDocument pom) throws XMLStreamException {
508508

509509
int lastIndex = 0;
510510

511-
singleElementsWithAttributes.sort(
512-
Comparator.comparingInt(matchDataJ -> matchDataJ.getRange().getFirst()));
513-
514-
for (MatchData match : singleElementsWithAttributes) {
515-
MatchResult representationMatch =
516-
match.getModifiedContent().find(xmlRepresentation, lastIndex);
517-
518-
if (null == representationMatch) {
519-
LOGGER.warn("Failure on quoting: {}", match);
520-
} else {
521-
xmlRepresentation =
522-
replaceRange(xmlRepresentation, representationMatch.getRange(), match.getContent());
523-
lastIndex = representationMatch.getRange().getFirst() + match.getContent().length();
524-
}
525-
}
511+
// singleElementsWithAttributes.sort(
512+
// Comparator.comparingInt(matchDataJ -> matchDataJ.getRange().getFirst()));
513+
514+
// for (MatchData match : singleElementsWithAttributes) {
515+
// MatchResult representationMatch =
516+
// match.getModifiedContent().find(xmlRepresentation, lastIndex);
517+
518+
// if (null == representationMatch) {
519+
// LOGGER.warn("Failure on quoting: {}", match);
520+
// } else {
521+
// xmlRepresentation =
522+
// replaceRange(xmlRepresentation, representationMatch.getRange(), match.getContent());
523+
// lastIndex = representationMatch.getRange().getFirst() + match.getContent().length();
524+
// }
525+
// }
526526

527527
/**
528528
* We might need to replace the beginning of the POM with the same content from the very

plugins/codemodder-plugin-maven/src/test/java/io/codemodder/plugins/maven/operator/POMOperatorTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.dom4j.Document;
1818
import org.dom4j.DocumentException;
1919
import org.hamcrest.MatcherAssert;
20+
import org.junit.jupiter.api.Disabled;
2021
import org.junit.jupiter.api.Test;
2122
import org.slf4j.Logger;
2223
import org.slf4j.LoggerFactory;
@@ -589,6 +590,7 @@ void modify_adds_dependency_to_file_with_tabs()
589590
* validates the resulting POM structure.
590591
*/
591592
@Test
593+
@Disabled
592594
void modify_adds_dependency_to_pom_with_empty_elements_from_customer() throws Exception {
593595
Dependency dependencyToUpgrade =
594596
new Dependency("io.github.pixee", "java-security-toolkit", "1.0.2", null, null, null);

0 commit comments

Comments
 (0)