Skip to content

Commit

Permalink
Merge pull request #2129 from georgekankava/staging/literal-boolean-v…
Browse files Browse the repository at this point in the history
…alues-should-not-be-used-in-condition-expressions-fix-1

squid:S1125 - Literal boolean values should not be used in condition expressions
  • Loading branch information
mposolda committed Jan 29, 2016
2 parents a7619f9 + 92a4943 commit 41551e0
Show file tree
Hide file tree
Showing 19 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected Group createGroup(String name, Set<Principal> principals) {
Iterator<Principal> iter = principals.iterator();
while (iter.hasNext()) {
Object next = iter.next();
if ((next instanceof Group) == false)
if (!(next instanceof Group))
continue;
Group grp = (Group) next;
if (grp.getName().equals(name)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected String changeHttpSessionId(boolean create) {
if (session == null) {
return request.getSession(true).getId();
}
if (deployment.isTurnOffChangeSessionIdOnLogin() == false) return request.changeSessionId();
if (!deployment.isTurnOffChangeSessionIdOnLogin()) return request.changeSessionId();
else return session.getId();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected String changeHttpSessionId(boolean create) {
if (session == null) {
return request.getSession(true).getId();
}
if (deployment.isTurnOffChangeSessionIdOnLogin() == false) return request.changeSessionId();
if (!deployment.isTurnOffChangeSessionIdOnLogin()) return request.changeSessionId();
else return session.getId();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected String changeHttpSessionId(boolean create) {
if (session == null) {
return request.getSession(true).getId();
}
if (deployment.isTurnOffChangeSessionIdOnLogin() == false) return request.changeSessionId();
if (!deployment.isTurnOffChangeSessionIdOnLogin()) return request.changeSessionId();
else return session.getId();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected KeycloakUndertowAccount createAccount(KeycloakPrincipal<RefreshableKey

@Override
protected String changeHttpSessionId(boolean create) {
if (deployment.isTurnOffChangeSessionIdOnLogin() == false) return ChangeSessionId.changeSessionId(exchange, create);
if (!deployment.isTurnOffChangeSessionIdOnLogin()) return ChangeSessionId.changeSessionId(exchange, create);
else return getHttpSessionId(create);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected static Group createGroup(String name, Set<Principal> principals) {
Iterator<Principal> iter = principals.iterator();
while (iter.hasNext()) {
Object next = iter.next();
if ((next instanceof Group) == false)
if (!(next instanceof Group))
continue;
Group grp = (Group) next;
if (grp.getName().equals(name)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected Group createGroup(String name, Set<Principal> principals) {
Iterator<Principal> iter = principals.iterator();
while (iter.hasNext()) {
Object next = iter.next();
if ((next instanceof Group) == false)
if (!(next instanceof Group))
continue;
Group grp = (Group) next;
if (grp.getName().equals(name)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public Jetty9SamlSessionStore(Request request, AdapterSessionStore sessionStore,
@Override
protected String changeSessionId(HttpSession session) {
Request request = this.request;
if (deployment.turnOffChangeSessionIdOnLogin() == false) return request.changeSessionId();
if (!deployment.turnOffChangeSessionIdOnLogin()) return request.changeSessionId();
else return session.getId();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public Jetty9SamlSessionStore(Request request, AdapterSessionStore sessionStore,
@Override
protected String changeSessionId(HttpSession session) {
Request request = this.request;
if (deployment.turnOffChangeSessionIdOnLogin() == false) return request.changeSessionId();
if (!deployment.turnOffChangeSessionIdOnLogin()) return request.changeSessionId();
else return session.getId();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public Tomcat8SamlSessionStore(CatalinaUserSessionManagement sessionManagement,
@Override
protected String changeSessionId(Session session) {
Request request = this.request;
if (deployment.turnOffChangeSessionIdOnLogin() == false) return request.changeSessionId();
if (!deployment.turnOffChangeSessionIdOnLogin()) return request.changeSessionId();
else return session.getId();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void saveAccount(SamlSession account) {
}

protected String changeSessionId(HttpSession session) {
if (deployment.turnOffChangeSessionIdOnLogin() == false) return ChangeSessionId.changeSessionId(exchange, false);
if (!deployment.turnOffChangeSessionIdOnLogin()) return ChangeSessionId.changeSessionId(exchange, false);
else return session.getId();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected static Group createGroup(String name, Set<Principal> principals) {
Iterator<Principal> iter = principals.iterator();
while (iter.hasNext()) {
Object next = iter.next();
if ((next instanceof Group) == false)
if (!(next instanceof Group))
continue;
Group grp = (Group) next;
if (grp.getName().equals(name)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class KeycloakLoginModule extends AbstractServerLoginModule {
@Override
public boolean login() throws LoginException {
log.debug("KeycloakLoginModule.login()");
if (super.login() == true) {
if (super.login()) {
log.debug("super.login()==true");
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected Group createGroup(String name, Set<Principal> principals) {
Iterator<Principal> iter = principals.iterator();
while (iter.hasNext()) {
Object next = iter.next();
if ((next instanceof Group) == false)
if (!(next instanceof Group))
continue;
Group grp = (Group) next;
if (grp.getName().equals(name)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ else if (PATH_SEPARATOR_ALIAS.equals(key))
}

// No properties
if (properties == false)
if (!properties)
return string;

// Collect the trailing characters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static String getSystemPropertyAsString(String str) {
* @param second
*/
public static void match(String first, String second) {
if (first.equals(second) == false)
if (!first.equals(second))
throw logger.notEqualError(first, second);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private static class PicketLinkStaxToDOMTransformer extends Transformer {
public void transform(Source xmlSource, Result outputTarget) throws TransformerException {
if (!(xmlSource instanceof StAXSource))
throw logger.wrongTypeError("xmlSource should be a stax source");
if (outputTarget instanceof DOMResult == false)
if (!(outputTarget instanceof DOMResult))
throw logger.wrongTypeError("outputTarget should be a dom result");

String rootTag = null;
Expand All @@ -208,7 +208,7 @@ public void transform(Source xmlSource, Result outputTarget) throws TransformerE

try {
XMLEvent xmlEvent = StaxParserUtil.getNextEvent(xmlEventReader);
if (xmlEvent instanceof StartElement == false)
if (!(xmlEvent instanceof StartElement))
throw new TransformerException(ErrorCodes.WRITER_SHOULD_START_ELEMENT);

StartElement rootElement = (StartElement) xmlEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public static AttributeStatementType createAttributeStatement(List<String> roles
* @return
*/
public static AttributeStatementType createAttributeStatementForRoles(List<String> roles, boolean multivalued) {
if (multivalued == false) {
if (!multivalued) {
return createAttributeStatement(roles);
}
AttributeStatementType attrStatement = new AttributeStatementType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private static class CustomErrorHandler implements ErrorHandler {

public void error(SAXParseException ex) throws SAXException {
logException(ex);
if (ex.getMessage().contains("null") == false) {
if (!ex.getMessage().contains("null")) {
throw ex;
}
}
Expand Down

0 comments on commit 41551e0

Please sign in to comment.