[MPMD-366] Update parent pom to 39 by elharo · Pull Request #118 · apache/maven-pmd-plugin (original) (raw)

@elharo

michael-o

@elharo

@elharo

This is failing locally with java 11 on a Mac. Looks like an XML reader or writer might have screwed up encoding somewhere:

\n[ERROR] Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.21.0-SNAPSHOT:check (default) on project mpmd-138-mod-1: Unable to read PMD results xml: /Users/elharo/maven-pmd-plugin/target/it/mpmd-138/mod-1/target/pmd.xml: UTF-8 BOM plus xml decl of ISO-8859-1 is incompatible (position: START_DOCUMENT seen <?xml version="1.0" encoding="ISO-8859-1"... @1:42) -> [Help 1]\n[ERROR] \n[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.\n[ERROR] Re-run Maven using the -X switch to enable full debug logging.\n[ERROR] \n[ERROR] For more information about the errors and possible solutions, please read the following articles:\n[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException\n[ERROR] \n[ERROR] After correcting the problems, you can resume the build with the command\n[ERROR] mvn -rf :mpmd-138-mod-1\nRunning post-build script: /Users/elharo/maven-pmd-plugin/target/it/mpmd-138/verify.groovy\n'
| /Users/elharo/maven-pmd-plugin/target/it/mpmd-138/build.log
false

@elharo

I don't see a byte order mark in the hex dump so the error message is strange.

(base) ~/maven-pmd-plugin$ hexdump /Users/elharo/maven-pmd-plugin/target/it/mpmd-138/mod-1/target/pmd.xml
0000000 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31

@elharo

specific error likely comes from org.codehaus.plexus.util.xml.pull somewhere. Whether that is buggy or there's an actual problem in this file I'm not yet sure.

@elharo

@elharo

Problem is likely in this and similar code in the several violation check mojos:

    @Override
    protected List<Duplication> getErrorDetails( File cpdFile )
        throws XmlPullParserException, IOException
    {
        try ( FileReader fileReader = new FileReader( cpdFile ) )
        {
            CpdXpp3Reader reader = new CpdXpp3Reader();
            CpdErrorDetail details = reader.read( fileReader, false );
            return details.getDuplications();
        }
    }

It passes or fails depending on the system encoding. Instead it should use an inputstream rather than a reader and rely on the XML parser to detect the encoding.

@elharo

I filed and will have to fix MPMD-369 before this PR can proceed. :-(

@elharo

@jira-importer

1 similar comment

@jira-importer

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})