Cleanup unnecessary unboxing

Unboxing is unnecessary under Java 5 and newer, and can be safely removed.
This commit is contained in:
Lars Grefer 2019-08-01 23:30:53 +02:00 committed by Josh Cummings
parent 2306d987e9
commit 2056834432
16 changed files with 21 additions and 23 deletions

View File

@ -127,8 +127,7 @@ public class AclPermissionEvaluator implements PermissionEvaluator {
List<Permission> resolvePermission(Object permission) {
if (permission instanceof Integer) {
return Arrays.asList(permissionFactory.buildFromMask(((Integer) permission)
.intValue()));
return Arrays.asList(permissionFactory.buildFromMask((Integer) permission));
}
if (permission instanceof Permission) {

View File

@ -146,10 +146,9 @@ public class JdbcMutableAclService extends JdbcAclService implements MutableAclS
"Unknown ACE class");
AccessControlEntryImpl entry = (AccessControlEntryImpl) entry_;
stmt.setLong(1, ((Long) acl.getId()).longValue());
stmt.setLong(1, (Long) acl.getId());
stmt.setInt(2, i);
stmt.setLong(3, createOrRetrieveSidPrimaryKey(entry.getSid(), true)
.longValue());
stmt.setLong(3, createOrRetrieveSidPrimaryKey(entry.getSid(), true));
stmt.setInt(4, entry.getPermission().getMask());
stmt.setBoolean(5, entry.isGranting());
stmt.setBoolean(6, entry.isAuditSuccess());

View File

@ -66,7 +66,7 @@ public class PasswordEncoderParser {
boolean useBase64 = false;
if (StringUtils.hasText(element.getAttribute(ATT_BASE_64))) {
useBase64 = Boolean.valueOf(element.getAttribute(ATT_BASE_64)).booleanValue();
useBase64 = Boolean.valueOf(element.getAttribute(ATT_BASE_64));
}
String ref = element.getAttribute(ATT_REF);

View File

@ -23,7 +23,7 @@ public final class ExpressionUtils {
public static boolean evaluateAsBoolean(Expression expr, EvaluationContext ctx) {
try {
return expr.getValue(ctx, Boolean.class).booleanValue();
return expr.getValue(ctx, Boolean.class);
}
catch (EvaluationException e) {
throw new IllegalArgumentException("Failed to evaluate expression '"

View File

@ -105,7 +105,7 @@ public class KeyBasedPersistenceTokenService implements TokenService, Initializi
long creationTime;
try {
creationTime = Long.decode(tokens[0]).longValue();
creationTime = Long.decode(tokens[0]);
}
catch (NumberFormatException nfe) {
throw new IllegalArgumentException("Expected number but found " + tokens[0]);
@ -144,7 +144,7 @@ public class KeyBasedPersistenceTokenService implements TokenService, Initializi
}
private String computeServerSecretApplicableAt(long time) {
return serverSecret + ":" + new Long(time % serverInteger.intValue()).intValue();
return serverSecret + ":" + new Long(time % serverInteger).intValue();
}
/**

View File

@ -119,7 +119,7 @@ public class SpringSecurityLdapTemplate extends LdapTemplate {
Boolean matches = (Boolean) executeReadOnly(new LdapCompareCallback());
return matches.booleanValue();
return matches;
}
/**

View File

@ -299,7 +299,7 @@ public class PasswordPolicyResponseControl extends PasswordPolicyControl {
return new BEREnumerated(stream, bytesRead);
}
else {
if (this.inChoice.booleanValue()) {
if (this.inChoice) {
// graceLogins
return new BERInteger(stream, bytesRead);
}

View File

@ -44,7 +44,7 @@ public class AddPermissionValidator implements Validator {
"Recipient is required. *");
if (addPermission.getPermission() != null) {
int permission = addPermission.getPermission().intValue();
int permission = addPermission.getPermission();
if ((permission != BasePermission.ADMINISTRATION.getMask())
&& (permission != BasePermission.READ.getMask())

View File

@ -104,8 +104,8 @@ public class PortMapperImpl implements PortMapper {
Integer httpPort = Integer.valueOf(entry.getKey());
Integer httpsPort = Integer.valueOf(entry.getValue());
if ((httpPort.intValue() < 1) || (httpPort.intValue() > 65535)
|| (httpsPort.intValue() < 1) || (httpsPort.intValue() > 65535)) {
if ((httpPort < 1) || (httpPort > 65535)
|| (httpsPort < 1) || (httpsPort > 65535)) {
throw new IllegalArgumentException(
"one or both ports out of legal range: " + httpPort + ", "
+ httpsPort);

View File

@ -63,7 +63,7 @@ public class PortResolverImpl implements PortResolver {
if (portLookup != null) {
// IE 6 bug
serverPort = portLookup.intValue();
serverPort = portLookup;
}
return serverPort;

View File

@ -67,7 +67,7 @@ public abstract class AbstractRetryEntryPoint implements ChannelEntryPoint {
Integer redirectPort = getMappedPort(currentPort);
if (redirectPort != null) {
boolean includePort = redirectPort.intValue() != standardPort;
boolean includePort = redirectPort != standardPort;
redirectUrl = scheme + request.getServerName()
+ ((includePort) ? (":" + redirectPort) : "") + redirectUrl;

View File

@ -196,7 +196,7 @@ public class LoginUrlAuthenticationEntryPoint implements AuthenticationEntryPoin
if (httpsPort != null) {
// Overwrite scheme and port in the redirect URL
urlBuilder.setScheme("https");
urlBuilder.setPort(httpsPort.intValue());
urlBuilder.setPort(httpsPort);
}
else {
logger.warn("Unable to redirect to HTTPS as no port mapping found for HTTP port "
@ -221,7 +221,7 @@ public class LoginUrlAuthenticationEntryPoint implements AuthenticationEntryPoin
RedirectUrlBuilder urlBuilder = new RedirectUrlBuilder();
urlBuilder.setScheme("https");
urlBuilder.setServerName(request.getServerName());
urlBuilder.setPort(httpsPort.intValue());
urlBuilder.setPort(httpsPort);
urlBuilder.setContextPath(request.getContextPath());
urlBuilder.setServletPath(request.getServletPath());
urlBuilder.setPathInfo(request.getPathInfo());

View File

@ -102,7 +102,7 @@ public class TokenBasedRememberMeServices extends AbstractRememberMeServices {
long tokenExpiryTime;
try {
tokenExpiryTime = new Long(cookieTokens[1]).longValue();
tokenExpiryTime = new Long(cookieTokens[1]);
}
catch (NumberFormatException nfe) {
throw new InvalidCookieException(

View File

@ -417,7 +417,7 @@ public class DigestAuthenticationFilter extends GenericFilterBean
// Extract expiry time from nonce
try {
this.nonceExpiryTime = new Long(nonceTokens[0]).longValue();
this.nonceExpiryTime = new Long(nonceTokens[0]);
}
catch (NumberFormatException nfe) {
throw new BadCredentialsException(DigestAuthenticationFilter.this.messages

View File

@ -183,7 +183,7 @@ public class FastHttpDateFormat {
}
if (cachedDate != null) {
return cachedDate.longValue();
return cachedDate;
}
Long date;
@ -206,7 +206,7 @@ public class FastHttpDateFormat {
return (-1L);
}
else {
return date.longValue();
return date;
}
}

View File

@ -52,7 +52,7 @@ public class ELRequestMatcher implements RequestMatcher {
public boolean matches(HttpServletRequest request) {
EvaluationContext context = createELContext(request);
return expression.getValue(context, Boolean.class).booleanValue();
return expression.getValue(context, Boolean.class);
}
/**