mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 06:12:05 +01:00
Add checkstyle rule for "Boolean.valueOf()" usages
This commit is contained in:
parent
dbfc123e5e
commit
fa7297019d
4 changed files with 11 additions and 0 deletions
|
@ -89,6 +89,11 @@
|
||||||
<property name="message" value="Usage of println"/>
|
<property name="message" value="Usage of println"/>
|
||||||
<property name="ignoreComments" value="true"/>
|
<property name="ignoreComments" value="true"/>
|
||||||
</module>
|
</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">
|
<module name="RegexpSinglelineJava">
|
||||||
<property name="format" value="^\t+"/>
|
<property name="format" value="^\t+"/>
|
||||||
<property name="message" value="Indent must not use tab characters. Use space instead."/>
|
<property name="message" value="Indent must not use tab characters. Use space instead."/>
|
||||||
|
|
|
@ -123,7 +123,9 @@ public class IntrospectionProvider{
|
||||||
case "java.lang.String":
|
case "java.lang.String":
|
||||||
return value;
|
return value;
|
||||||
case "boolean":
|
case "boolean":
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
return Boolean.valueOf(value);
|
return Boolean.valueOf(value);
|
||||||
|
// CHECKSTYLE:ON
|
||||||
case "int":
|
case "int":
|
||||||
return Integer.valueOf(value);
|
return Integer.valueOf(value);
|
||||||
case "long":
|
case "long":
|
||||||
|
|
|
@ -92,7 +92,9 @@ public class JivePropertiesExtensionProvider extends ExtensionElementProvider<Ji
|
||||||
value = Double.valueOf(valueText);
|
value = Double.valueOf(valueText);
|
||||||
}
|
}
|
||||||
else if ("boolean".equals(type)) {
|
else if ("boolean".equals(type)) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
value = Boolean.valueOf(valueText);
|
value = Boolean.valueOf(valueText);
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
else if ("string".equals(type)) {
|
else if ("string".equals(type)) {
|
||||||
value = valueText;
|
value = valueText;
|
||||||
|
|
|
@ -104,7 +104,9 @@ public class WorkgroupProperties extends IQ {
|
||||||
while (!done) {
|
while (!done) {
|
||||||
int eventType = parser.next();
|
int eventType = parser.next();
|
||||||
if ((eventType == XmlPullParser.START_TAG) && ("authRequired".equals(parser.getName()))) {
|
if ((eventType == XmlPullParser.START_TAG) && ("authRequired".equals(parser.getName()))) {
|
||||||
|
// CHECKSTYLE:OFF
|
||||||
props.setAuthRequired(Boolean.valueOf(parser.nextText()).booleanValue());
|
props.setAuthRequired(Boolean.valueOf(parser.nextText()).booleanValue());
|
||||||
|
// CHECKSTYLE:ON
|
||||||
}
|
}
|
||||||
else if ((eventType == XmlPullParser.START_TAG) && ("email".equals(parser.getName()))) {
|
else if ((eventType == XmlPullParser.START_TAG) && ("email".equals(parser.getName()))) {
|
||||||
props.setEmail(parser.nextText());
|
props.setEmail(parser.nextText());
|
||||||
|
|
Loading…
Reference in a new issue