Menu

#1144 CPD encoding argument has no effect

PMD-5.1.0
closed
None
CPD
1-Blocker
Bug
2013-10-29
2013-10-28
Peter Bruin
No

The problem is that CPD generates invalid xml files when used on Windows. The standard encoding is Cp1252 which is not an official character set.
This results in problems down stream when the xml is parsed by a Jenkins plugin, the Digester3 parser will throw an exception that the encoding is not recognized.

The cause is that the XmlRenderer is created BEFORE the encoding argument is processed. The fix is simple, process the encoding argument before the format argument.

Discussion

  • Peter Bruin

    Peter Bruin - 2013-10-28

    I have created a pull request for this on github:
    https://github.com/pmd/pmd/pull/27

     
  • Andreas Dangel

    Andreas Dangel - 2013-10-29

    Hi Peter, thanks for the pull request. It is integrated in the source code, but we are not sure, when we will release a next version.
    Can you try, whether adding the system property "-Dfile.encoding=UTF-8" would be a workaround for you?
    Simply add it to the OPTS variable in cpd.bat or directly to the java call.
    Regards,
    Andreas

     
  • Andreas Dangel

    Andreas Dangel - 2013-10-29
    • status: open --> closed
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-5.1.0
     

Log in to post a comment.