Commit Graph

187 Commits

Author SHA1 Message Date
43a38d3144 Console encoding only when interactive 2017-01-10 09:54:44 -03:00
d7c503bee4 checkstyle fixes 2017-01-10 09:54:44 -03:00
958f8df5f5 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).
2017-01-10 09:54:44 -03:00
89600bfcc4 checkstyle fixes 2017-01-10 09:54:44 -03:00
abf65acb63 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
2017-01-10 09:54:44 -03:00
4c71b0da4a checkstyle fixes 2017-01-10 09:54:44 -03:00
368313fd8f Update Formatter.java 2017-01-10 09:54:44 -03:00
74583d003a 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 ?
2017-01-10 09:54:44 -03:00
eca1f7c8ef Remove synchronization from RuleContext 2016-11-26 17:07:05 +01:00
87f26e57e7 Use a LRU cache in SaxonXPathRuleQuery 2016-11-26 17:07:05 +01:00
49e3de4a06 Allow concurrency in AttributeAxisIterator 2016-11-26 17:03:32 +01:00
e78f80416a [maven-release-plugin] prepare for next development iteration 2016-11-04 21:01:18 +01:00
5019eb11e4 [maven-release-plugin] prepare release pmd_releases/5.4.3 2016-11-04 21:01:18 +01:00
7578875cbd #1508 - Only close the classloader if its ours 2016-07-26 21:49:33 +02:00
42a5c6a537 Merge branch 'bug-1508' into pmd/5.4.x 2016-07-26 21:42:55 +02:00
d76b689c07 Fixes #1508 [core] [java] PMD is leaking file handles
Closes class loader after PMD has processed all files
2016-07-25 21:42:21 +02:00
293731f009 Fixes #1508 [core] [java] PMD is leaking file handles
Closes class loader after ant task is finished
2016-07-25 21:34:40 +02:00
88d1823c2e Fixes #1508 [core] [java] PMD is leaking file handles
Fixes InputStreams and Readers
2016-07-25 21:25:34 +02:00
e25bd5e9c1 Merge branch 'bug-1499' into pmd/5.4.x 2016-07-02 16:54:50 +02:00
553cafff6e Fixes #1499 [core] CPD test break PMD 5.5.1 build on Windows 2016-07-02 16:48:46 +02:00
4512da8f3f [maven-release-plugin] prepare for next development iteration 2016-05-29 20:04:35 +02:00
5fa4b309ed [maven-release-plugin] prepare release pmd_releases/5.4.2 2016-05-29 20:04:34 +02:00
dc1d942241 Merge branch 'bug-1481' into pmd/5.4.x 2016-05-28 11:42:01 +02:00
13f7675b67 Fixes #1481 no problems found results in blank file instead of empty xml 2016-05-28 11:27:22 +02:00
6cd0ca309f Merge branch 'issue-1360-ruleset-compatibility' into pmd/5.4.x 2016-05-18 20:57:53 +02:00
f32beeb726 Provide a command line option for #1360 - "-noRuleSetCompatibility" 2016-05-18 20:38:44 +02:00
fadd6a9a1c Merge branch 'issue-1360-ruleset-compatibility' into pmd/5.4.x 2016-05-13 19:02:53 +02:00
1b65c7fe91 References #1360 Provide backwards combatibility for PMD configuration file
Handle exclusions
2016-05-13 18:53:00 +02:00
44ee51d5a6 References #1360 Provide backwards combatibility for PMD configuration file
Add test cases for excluded rules
2016-05-06 11:08:25 +02:00
15fd444b7a References #1360 Provide backwards combatibility for PMD configuration file 2016-05-06 10:52:43 +02:00
2afd30c283 [maven-release-plugin] prepare for next development iteration 2016-04-30 23:15:13 +02:00
d89549f994 [maven-release-plugin] prepare release pmd_releases/5.3.7 2016-04-30 23:15:13 +02:00
395a40a7ae Merge branch 'pr-33' into pmd/5.4.x 2016-03-29 20:06:23 +02:00
e58feea9cd Merge branch 'bug-1461-doc' into pmd/5.4.x 2016-03-13 15:29:10 +01:00
c571abdb1d Merge branch 'bug-1461-doc' into pmd/5.3.x 2016-03-13 15:28:58 +01:00
0725586b9a Update documentation about thread safety of rules (see #1461) 2016-03-13 15:28:37 +01:00
3dd8156014 Merge branch 'bug-1461' into pmd/5.4.x 2016-03-10 20:23:43 +01:00
ccbb372a4f Fix compile error (pmd 5.3.x is on java6) 2016-03-10 20:19:30 +01:00
4a0802a269 Revert "RuleSetFactory Performance Enhancement:-"
This reverts commit 9da51952ef.
2016-03-10 20:11:06 +01:00
3de70426cf Revert "Update changelog, keep backwards compatible createRuleSets methods by overloading"
This reverts commit b753cc5ec5.
2016-03-10 20:10:58 +01:00
54ce3036b2 Add unit test to verify concurrency issue #1461
References pr #75
2016-03-10 20:10:51 +01:00
a42cb1b0c2 Merge branch 'pr-31' into pmd/5.4.x 2016-01-21 20:30:39 +01:00
04527bc4cb Update changelog 2016-01-21 20:23:02 +01:00
82178809fa Merge branch 'detect_file_encoding_using_UTF_BOM' of https://github.com/tiobe/pmd into pr-31 2016-01-21 20:10:22 +01:00
bd64e4fdc6 Merge branch 'pr-30' into pmd/5.4.x 2016-01-20 22:24:08 +01:00
b9b6e13849 Update changelog 2016-01-20 22:08:28 +01:00
64441c8e93 Merge branch 'tiobe/remove_filefilter_for_files' of https://github.com/tiobe/pmd into pr-30 2016-01-20 21:38:23 +01:00
607606534d Added file encoding detection to CPD. 2016-01-11 13:57:04 +01:00
2b72dcabf2 Merge branch 'pr-83' into pmd/5.4.x
Closes #83 (rebased)
2016-01-07 10:52:28 +01:00
e08ba3ea30 Update changelog 2016-01-07 10:50:48 +01:00