Branch: refs/heads/pmd/5.5.x
Home: https://github.com/pmd/pmd
Commit: 74583d003a841af280e7fea8f3ae3521dfcbb89b
https://github.com/pmd/pmd/commit/74583d003a841af280e7fea8f3ae3521dfcbb89b
Author: pyxide <op...@gm...>
Date: 2017-01-10 (Tue, 10 Jan 2017)
Changed paths:
M pmd-core/src/main/java/net/sourceforge/pmd/ant/Formatter.java
Log Message:
-----------
Ant Task Formatter encoding issue with XMLRenderer
Hi,
The writers in the Ant task's formatter uses the default platform's encoding (for instance cp1252 on Western Windows) and the XMLRenderer sets the default XML encoding to UTF-8. This may lead to incorrect XML encoding, detected for instance when the XML file is sent to a XSLT task.
This goes undetected as long as the characters in the XML file are in the ASCII subset, which is frequently the case with code, usually in plain Latin language. In my case, the issue was raised because of the localized formatting of some line numbers greater than 999, due to localized thousand separator 0xA0, which is out of the ASCII subset.
I modified the Formatter class to always use a charset for writers. When no encoding is specified, UTF-8 is used instead of the default platform's encoding.
I strongly recommend to *always set the encoding parameter* of the formatter element. It should be reflected as so in the Ant Task documentation.
```xml
<pmd encoding="cp1252"> <!-- source encoding -->
<formatter type="xml" toFile="pmd.xml">
<param name="encoding" value="UTF-8" /> <!-- report encoding -->
</formatter>
<fileset dir="src/main/java">
<include name="**/*.java"/>
</fileset>
</pmd>
```
Note: when digging into sourceforge issues for similar bugs, I found [Bug 877: Output with encoding CP1252](https://sourceforge.net/p/pmd/bugs/877/) . Not the same task, but the same symptoms, probably the same cause ?
Commit: 368313fd8f246300b6f38159029f217b1eedaef0
https://github.com/pmd/pmd/commit/368313fd8f246300b6f38159029f217b1eedaef0
Author: pyxide <op...@gm...>
Date: 2017-01-10 (Tue, 10 Jan 2017)
Changed paths:
M pmd-core/src/main/java/net/sourceforge/pmd/ant/Formatter.java
Log Message:
-----------
Update Formatter.java
Commit: 4c71b0da4ad11049d01aa5c2e10292711cf7b5dc
https://github.com/pmd/pmd/commit/4c71b0da4ad11049d01aa5c2e10292711cf7b5dc
Author: pyxide <op...@gm...>
Date: 2017-01-10 (Tue, 10 Jan 2017)
Changed paths:
M pmd-core/src/main/java/net/sourceforge/pmd/ant/Formatter.java
Log Message:
-----------
checkstyle fixes
Commit: abf65acb63522a6332020821efef7c275bec275c
https://github.com/pmd/pmd/commit/abf65acb63522a6332020821efef7c275bec275c
Author: pyxide <op...@gm...>
Date: 2017-01-10 (Tue, 10 Jan 2017)
Changed paths:
M pmd-core/src/main/java/net/sourceforge/pmd/ant/Formatter.java
Log Message:
-----------
Bug fix and enhanced console output encoding
- due to some rewriting without testing, the encoding property was not added to the renderer properties.
- better console encoding: use system property `sun.stdout.encoding` in interactive console, and `file.encoding` in piped or redirected output
Commit: 89600bfcc4e7d75f67bfbeb77dc04865c8355921
https://github.com/pmd/pmd/commit/89600bfcc4e7d75f67bfbeb77dc04865c8355921
Author: pyxide <op...@gm...>
Date: 2017-01-10 (Tue, 10 Jan 2017)
Changed paths:
M pmd-core/src/main/java/net/sourceforge/pmd/ant/Formatter.java
Log Message:
-----------
checkstyle fixes
Commit: 958f8df5f557a381e556818f156bc03b981dfed8
https://github.com/pmd/pmd/commit/958f8df5f557a381e556818f156bc03b981dfed8
Author: pyxide <op...@gm...>
Date: 2017-01-10 (Tue, 10 Jan 2017)
Changed paths:
M pmd-core/src/main/java/net/sourceforge/pmd/ant/Formatter.java
Log Message:
-----------
Reflection detection code for console encoding
Note: calling the static native method `String Console.encoding()` returns the current console encoding, even if `System.console()` is null because the console is not interactive (pipe or redirection).
Commit: d7c503bee4209ac3ae4359c45c1d8db2ee8694db
https://github.com/pmd/pmd/commit/d7c503bee4209ac3ae4359c45c1d8db2ee8694db
Author: pyxide <op...@gm...>
Date: 2017-01-10 (Tue, 10 Jan 2017)
Changed paths:
M pmd-core/src/main/java/net/sourceforge/pmd/ant/Formatter.java
Log Message:
-----------
checkstyle fixes
Commit: 43a38d314433e6f4f1345d793cb418157849765c
https://github.com/pmd/pmd/commit/43a38d314433e6f4f1345d793cb418157849765c
Author: pyxide <op...@gm...>
Date: 2017-01-10 (Tue, 10 Jan 2017)
Changed paths:
M pmd-core/src/main/java/net/sourceforge/pmd/ant/Formatter.java
Log Message:
-----------
Console encoding only when interactive
Commit: 1cfbdc9268425ed558a12e5c51f0f7bbab4b933c
https://github.com/pmd/pmd/commit/1cfbdc9268425ed558a12e5c51f0f7bbab4b933c
Author: Juan Martín Sotuyo Dodero <jms...@mo...>
Date: 2017-01-10 (Tue, 10 Jan 2017)
Changed paths:
M pmd-core/src/main/java/net/sourceforge/pmd/ant/Formatter.java
Log Message:
-----------
Merge branch 'pr-170' into pmd/5.5.x
Compare: https://github.com/pmd/pmd/compare/923aab806504...1cfbdc926842 |