0.3.2 issue with parsing xml

Frederik Mann September 28, 2022

Greetings,

something changed between 0.3.1 -> 0.3.1 when parsing a report's xml.

The pmd report was with version pmd 1.30 with the paramters "--format xslt --property xsltFilename=pmd/pmd-to-checkstyle.xsl --rulesets pmd/coe_pmd_ruleset.xml -language apex --report-file pmd/pmd-result.xml --fail-on-violation false".

SEVERE: Error when parsing /opt/atlassian/pipelines/agent/build/pmd-result.xml as se.bjurr.violations.lib.parsers.CheckStyleParser content:
<?xml version="1.0" encoding="UTF-8"?>
<file xmlns:pmd="http://pmd.sourceforge.net/report/2.0.0"
name="/opt/atlassian/pipelines/agent/build/force-app/main/default/classes/arlanisUtilities/ClsRecordTypeUtil.cls">
<error line="22" column="38" severity="info"
message="Missing or mismatched ApexDoc @param"
source="https://pmd.github.io/pmd-6.49.0/pmd_rules_apex_documentation.html#apexdoc"/>
<error line="134" column="30" severity="info" message="Missing ApexDoc comment"
source="https://pmd.github.io/pmd-6.49.0/pmd_rules_apex_documentation.html#apexdoc"/>
<error line="141" column="30" severity="info" message="Missing ApexDoc comment"
source="https://pmd.github.io/pmd-6.49.0/pmd_rules_apex_documentation.html#apexdoc"/>
<error line="152" column="30" severity="info" message="Missing ApexDoc comment"
source="https://pmd.github.io/pmd-6.49.0/pmd_rules_apex_documentation.html#apexdoc"/>
<error line="173" column="30" severity="info"
message="Missing or mismatched ApexDoc @param"
source="https://pmd.github.io/pmd-6.49.0/pmd_rules_apex_documentation.html#apexdoc"/>
</file>
<file xmlns:pmd="http://pmd.sourceforge.net/report/2.0.0"
name="/opt/atlassian/pipelines/agent/build/force-app/main/default/classes/arlanisUtilities/ClsRecordTypeUtil_Test.cls">
<error line="63" column="10" severity="info"
message="'System.assertEquals' should have 3 parameters."
source="https://pmd.github.io/pmd-6.49.0/pmd_rules_apex_bestpractices.html#apexassertionsshouldincludemessage"/>
<error line="73" column="10" severity="info"
message="'System.assertEquals' should have 3 parameters."
source="https://pmd.github.io/pmd-6.49.0/pmd_rules_apex_bestpractices.html#apexassertionsshouldincludemessage"/>
<error line="76" column="10" severity="info"
message="'System.assertEquals' should have 3 parameters."
source="https://pmd.github.io/pmd-6.49.0/pmd_rules_apex_bestpractices.html#apexassertionsshouldincludemessage"/>
<error line="79" column="10" severity="info"
message="'System.assertEquals' should have 3 parameters."
source="https://pmd.github.io/pmd-6.49.0/pmd_rules_apex_bestpractices.html#apexassertionsshouldincludemessage"/>
</file>

...more rules...


javax.xml.stream.XMLStreamException: ParseError at [row,col]:[17,2]
Message: The markup in the document following the root element must be well-formed.
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:604)
at se.bjurr.violations.lib.parsers.CheckStyleParser.parseReportOutput(CheckStyleParser.java:41)
at se.bjurr.violations.lib.reports.ViolationsFinder.findViolations(ViolationsFinder.java:35)
at se.bjurr.violations.lib.ViolationsApi.violations(ViolationsApi.java:103)
at com.atlassian.bitbucket.pipelines.checkstyle.report.Main.main(Main.java:99)

 

I think XML was not enforced before to be well-formed and it might be an issue with our pmd-to-checkstyle.xsl.

2 answers

1 accepted

0 votes
Answer accepted
Frederik Mann December 14, 2022

The issue was with the report.xml. It was missing a starting and enclosing tag.

0 votes
Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 30, 2022

@Frederik Mann hi. Can you confirm that all works on checkstyle-report 0.3.1 but not in version 0.3.2? We bumped violations lib from version 1.116 to 1.149

Regards, Igor.

Frederik Mann September 30, 2022

Hi @Igor Stoyanov , yes I can confirm that everything works when switching back from 0.3.2 to 0.3.1.

The very same report, then can be evaluated by checkstyle-report and is shown in the pipeline with results.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events