Remove empty block

Refactor a few classes so that empty blocks are not longer used. For
example, rather than:

	if(x) {
	} else {
		i++;
	}

use:

	if(!x) {
		i++;
	}

Issue gh-8945
This commit is contained in:
Phillip Webb 2020-07-24 18:42:11 -07:00 committed by Rob Winch
parent 37fa94fafc
commit b5d499e2eb
3 changed files with 13 additions and 21 deletions

View File

@ -85,9 +85,7 @@ public class SpringSecurityXsdParser {
if ("attribute".equals(name)) {
attrs.add(attr(c));
}
else if ("element".equals(name)) {
}
else {
else if (!"element".equals(name)) {
attrs.addAll(attrs(c));
}
});
@ -105,22 +103,21 @@ public class SpringSecurityXsdParser {
Collection<Attribute> attrgrp = new ArrayList<>();
element.children().forEach(c -> {
if ("element".equals(c.simpleName())) {
}
else if ("attributeGroup".equals(c.simpleName())) {
if (c.attribute("name") != null) {
attrgrp.addAll(attrgrp(c));
if (!"element".equals(c.simpleName())) {
if ("attributeGroup".equals(c.simpleName())) {
if (c.attribute("name") != null) {
attrgrp.addAll(attrgrp(c));
}
else {
String name = c.attribute("ref").split(":")[1];
XmlNode attrGrp = findNode(element, name);
attrgrp.addAll(attrgrp(attrGrp));
}
}
else {
String name = c.attribute("ref").split(":")[1];
XmlNode attrGrp = findNode(element, name);
attrgrp.addAll(attrgrp(attrGrp));
attrgrp.addAll(attrgrps(c));
}
}
else {
attrgrp.addAll(attrgrps(c));
}
});
return attrgrp;

View File

@ -3,7 +3,6 @@
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress files=".*" checks="EmptyBlock" />
<suppress files=".*" checks="FinalClass" />
<suppress files=".*" checks="InnerAssignment" />
<suppress files=".*" checks="InnerTypeLast" />
@ -32,7 +31,6 @@
<suppress files=".*" checks="SpringCatch" />
<suppress files=".*" checks="SpringHeader" />
<suppress files=".*" checks="SpringHideUtilityClassConstructor" />
<suppress files=".*" checks="SpringImportOrder" />
<suppress files=".*" checks="SpringJavadoc" />
<suppress files=".*" checks="SpringLambda" />
<suppress files=".*" checks="SpringMethodOrder" />

View File

@ -533,10 +533,7 @@ public class AbstractAuthenticationProcessingFilterTests {
}
public void doFilter(ServletRequest request, ServletResponse response) {
if (expectToProceed) {
}
else {
if (!expectToProceed) {
fail("Did not expect filter chain to proceed");
}
}