mojohaus / tidy-maven-plugin

The Tidy plugin provides goals for tidying up your source code.
https://www.mojohaus.org/tidy-maven-plugin/
Apache License 2.0
21 stars 15 forks source link

WstxParsingException when using properties ending on dependency or plugin. #51

Closed fweinhold closed 2 years ago

fweinhold commented 2 years ago

Hi guys!

I just found this line...

https://github.com/mojohaus/tidy-maven-plugin/blob/13217123e84238f3993158174b014b8bc6ae9b4f/src/main/java/org/codehaus/mojo/tidy/task/EnsureOrderAndIndent.java#L138

This actually should be return path.endsWith( "/" + scope ); as we are looking for the element named like the scope, not an element ending just with the scope...

The current version causes an exception when a property is ending with something like "-dependency" or "-plugin.

com.ctc.wstx.exc.WstxParsingException: Illegal processing instruction target ("xml"); xml (case insensitive) is reserved by the specs.
 at [row,col {unknown-source}]: [15,7]
    at com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:621)
    at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:491)
    at com.ctc.wstx.sr.BasicStreamReader.readPIPrimary(BasicStreamReader.java:4019)
    at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2141)
    at com.ctc.wstx.sr.BasicStreamReader.closeContentTree(BasicStreamReader.java:2991)
    at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2734)
    at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1123)
    at org.codehaus.stax2.ri.Stax2EventReaderImpl.nextEvent(Stax2EventReaderImpl.java:255)
    at org.codehaus.mojo.tidy.task.EnsureOrderAndIndent$SectionSorter.sortSections(EnsureOrderAndIndent.java:110)
    at org.codehaus.mojo.tidy.task.EnsureOrderAndIndent.tidyPom(EnsureOrderAndIndent.java:71)
    at org.codehaus.mojo.tidy.task.PomTidy.tidy(PomTidy.java:44)
pzygielo commented 2 years ago

Sounds like