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) { List<Permission> resolvePermission(Object permission) {
if (permission instanceof Integer) { if (permission instanceof Integer) {
return Arrays.asList(permissionFactory.buildFromMask(((Integer) permission) return Arrays.asList(permissionFactory.buildFromMask((Integer) permission));
.intValue()));
} }
if (permission instanceof Permission) { if (permission instanceof Permission) {

View File

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

View File

@ -66,7 +66,7 @@ public class PasswordEncoderParser {
boolean useBase64 = false; boolean useBase64 = false;
if (StringUtils.hasText(element.getAttribute(ATT_BASE_64))) { 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); String ref = element.getAttribute(ATT_REF);

View File

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

View File

@ -105,7 +105,7 @@ public class KeyBasedPersistenceTokenService implements TokenService, Initializi
long creationTime; long creationTime;
try { try {
creationTime = Long.decode(tokens[0]).longValue(); creationTime = Long.decode(tokens[0]);
} }
catch (NumberFormatException nfe) { catch (NumberFormatException nfe) {
throw new IllegalArgumentException("Expected number but found " + tokens[0]); throw new IllegalArgumentException("Expected number but found " + tokens[0]);
@ -144,7 +144,7 @@ public class KeyBasedPersistenceTokenService implements TokenService, Initializi
} }
private String computeServerSecretApplicableAt(long time) { 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()); 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); return new BEREnumerated(stream, bytesRead);
} }
else { else {
if (this.inChoice.booleanValue()) { if (this.inChoice) {
// graceLogins // graceLogins
return new BERInteger(stream, bytesRead); return new BERInteger(stream, bytesRead);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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