From af3ad2bc0240a93468bf86ec4aff45528da2e1d9 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sun, 8 Jan 2017 12:12:56 +0100 Subject: [PATCH 1/2] Fixes #1556 [java] UseLocaleWithCaseConversions does not works with `ResultSet` (false negative) --- .../main/resources/rulesets/java/design.xml | 24 ++++++++++++------- .../xml/UseLocaleWithCaseConversions.xml | 16 +++++++++++++ src/site/markdown/overview/changelog.md | 1 + 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/pmd-java/src/main/resources/rulesets/java/design.xml b/pmd-java/src/main/resources/rulesets/java/design.xml index dd67f21f08..64df23542f 100644 --- a/pmd-java/src/main/resources/rulesets/java/design.xml +++ b/pmd-java/src/main/resources/rulesets/java/design.xml @@ -709,8 +709,8 @@ public class Foo { @@ -723,13 +723,19 @@ have unusual conventions, i.e. Turkish. +//PrimaryExpression[not(PrimaryPrefix/Name[ends-with(@Image, 'toHexString')])] +[ +PrimaryPrefix +[following-sibling::PrimarySuffix[position() = 1]/Arguments[@ArgumentCount=0]] +/Name[ends-with(@Image, 'toLowerCase') or ends-with(@Image, 'toUpperCase')] + +or + +PrimarySuffix +[following-sibling::PrimarySuffix[position() = 1]/Arguments[@ArgumentCount=0]] +[ends-with(@Image, 'toLowerCase') or ends-with(@Image, 'toUpperCase')] +] +]]> diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/UseLocaleWithCaseConversions.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/UseLocaleWithCaseConversions.xml index 4cee71e5e2..391d847754 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/UseLocaleWithCaseConversions.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/UseLocaleWithCaseConversions.xml @@ -59,4 +59,20 @@ public class Foo { } ]]> + + + #1556 [java] UseLocaleWithCaseConversions does not works with `ResultSet` (false negative) + 1 + + diff --git a/src/site/markdown/overview/changelog.md b/src/site/markdown/overview/changelog.md index 8b4ea59648..4440494a9b 100644 --- a/src/site/markdown/overview/changelog.md +++ b/src/site/markdown/overview/changelog.md @@ -35,6 +35,7 @@ This is a bug fixing release, no major changes were introduced. * java-design * [#1552](https://sourceforge.net/p/pmd/bugs/1552/): \[java] MissingBreakInSwitch - False positive for continue + * [#1556](https://sourceforge.net/p/pmd/bugs/1556/): \[java] UseLocaleWithCaseConversions does not works with `ResultSet` (false negative) * [#177](https://github.com/pmd/pmd/issues/177): \[java] SingularField with lambdas as final fields * java-imports * [#1546](https://sourceforge.net/p/pmd/bugs/1546/): \[java] UnnecessaryFullyQualifiedNameRule doesn't take into consideration conflict resolution From c0e1c3e731d69bb55b40daf485b9fc927213926d Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sun, 8 Jan 2017 13:51:44 +0100 Subject: [PATCH 2/2] Slightly improve performance of XPath Rule UseLocaleWithCaseConversions --- pmd-java/src/main/resources/rulesets/java/design.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pmd-java/src/main/resources/rulesets/java/design.xml b/pmd-java/src/main/resources/rulesets/java/design.xml index 64df23542f..cd4cb02a7f 100644 --- a/pmd-java/src/main/resources/rulesets/java/design.xml +++ b/pmd-java/src/main/resources/rulesets/java/design.xml @@ -723,18 +723,19 @@ have unusual conventions, i.e. Turkish.