1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 20:47:57 +01:00

Add checkstyle rule for "Boolean.valueOf()" usages

This commit is contained in:
Florian Schmaus 2018-11-29 22:38:11 +01:00
parent dbfc123e5e
commit fa7297019d
4 changed files with 11 additions and 0 deletions

View file

@ -89,6 +89,11 @@
<property name="message" value="Usage of println"/>
<property name="ignoreComments" value="true"/>
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="Boolean\.valueOf\("/>
<property name="message" value="Usage Boolean.valueOf(), consider using ParserUtils.parseXmlBoolean() instead (if you want to parse xs:boolean values)"/>
<property name="ignoreComments" value="true"/>
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="^\t+"/>
<property name="message" value="Indent must not use tab characters. Use space instead."/>

View file

@ -123,7 +123,9 @@ public class IntrospectionProvider{
case "java.lang.String":
return value;
case "boolean":
// CHECKSTYLE:OFF
return Boolean.valueOf(value);
// CHECKSTYLE:ON
case "int":
return Integer.valueOf(value);
case "long":

View file

@ -92,7 +92,9 @@ public class JivePropertiesExtensionProvider extends ExtensionElementProvider<Ji
value = Double.valueOf(valueText);
}
else if ("boolean".equals(type)) {
// CHECKSTYLE:OFF
value = Boolean.valueOf(valueText);
// CHECKSTYLE:ON
}
else if ("string".equals(type)) {
value = valueText;

View file

@ -104,7 +104,9 @@ public class WorkgroupProperties extends IQ {
while (!done) {
int eventType = parser.next();
if ((eventType == XmlPullParser.START_TAG) && ("authRequired".equals(parser.getName()))) {
// CHECKSTYLE:OFF
props.setAuthRequired(Boolean.valueOf(parser.nextText()).booleanValue());
// CHECKSTYLE:ON
}
else if ((eventType == XmlPullParser.START_TAG) && ("email".equals(parser.getName()))) {
props.setEmail(parser.nextText());