Fixes #1556 [java] UseLocaleWithCaseConversions does not works with ResultSet (false negative)

This commit is contained in:
Andreas Dangel
2017-01-08 12:12:56 +01:00
parent f825cdb1db
commit af3ad2bc02
3 changed files with 32 additions and 9 deletions

View File

@ -723,13 +723,19 @@ have unusual conventions, i.e. Turkish.
<property name="xpath">
<value>
<![CDATA[
//PrimaryExpression
[PrimaryPrefix/Name
[ends-with(@Image, 'toLowerCase') or ends-with(@Image,
'toUpperCase')]
]
[PrimarySuffix[position() = 1]/Arguments[@ArgumentCount=0]]
]]>
//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')]
]
]]>
</value>
</property>
</properties>

View File

@ -56,6 +56,22 @@ public class Foo {
String x = "hello world";
return x.toUpperCase(Locale.GERMANY).trim();
}
}
]]></code>
</test-code>
<test-code>
<description>#1556 [java] UseLocaleWithCaseConversions does not works with `ResultSet` (false negative)</description>
<expected-problems>1</expected-problems>
<code><![CDATA[
import java.sql.*;
final class Test {
private Test() { }
public static String foo(ResultSet r) throws SQLException {
return r.getString("bar").toLowerCase();
}
}
]]></code>
</test-code>

View File

@ -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