Browse Source

Cleanup unnecessary unboxing

Unboxing is unnecessary under Java 5 and newer, and can be safely removed.
pull/7229/head
Lars Grefer 6 years ago committed by Josh Cummings
parent
commit
2056834432
  1. 3
      acl/src/main/java/org/springframework/security/acls/AclPermissionEvaluator.java
  2. 5
      acl/src/main/java/org/springframework/security/acls/jdbc/JdbcMutableAclService.java
  3. 2
      config/src/main/java/org/springframework/security/config/authentication/PasswordEncoderParser.java
  4. 2
      core/src/main/java/org/springframework/security/access/expression/ExpressionUtils.java
  5. 4
      core/src/main/java/org/springframework/security/core/token/KeyBasedPersistenceTokenService.java
  6. 2
      ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java
  7. 2
      ldap/src/main/java/org/springframework/security/ldap/ppolicy/PasswordPolicyResponseControl.java
  8. 2
      samples/xml/contacts/src/main/java/sample/contact/AddPermissionValidator.java
  9. 4
      web/src/main/java/org/springframework/security/web/PortMapperImpl.java
  10. 2
      web/src/main/java/org/springframework/security/web/PortResolverImpl.java
  11. 2
      web/src/main/java/org/springframework/security/web/access/channel/AbstractRetryEntryPoint.java
  12. 4
      web/src/main/java/org/springframework/security/web/authentication/LoginUrlAuthenticationEntryPoint.java
  13. 2
      web/src/main/java/org/springframework/security/web/authentication/rememberme/TokenBasedRememberMeServices.java
  14. 2
      web/src/main/java/org/springframework/security/web/authentication/www/DigestAuthenticationFilter.java
  15. 4
      web/src/main/java/org/springframework/security/web/savedrequest/FastHttpDateFormat.java
  16. 2
      web/src/main/java/org/springframework/security/web/util/matcher/ELRequestMatcher.java

3
acl/src/main/java/org/springframework/security/acls/AclPermissionEvaluator.java

@ -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) {

5
acl/src/main/java/org/springframework/security/acls/jdbc/JdbcMutableAclService.java

@ -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());

2
config/src/main/java/org/springframework/security/config/authentication/PasswordEncoderParser.java

@ -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);

2
core/src/main/java/org/springframework/security/access/expression/ExpressionUtils.java

@ -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 '"

4
core/src/main/java/org/springframework/security/core/token/KeyBasedPersistenceTokenService.java

@ -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();
} }
/** /**

2
ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java

@ -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;
} }
/** /**

2
ldap/src/main/java/org/springframework/security/ldap/ppolicy/PasswordPolicyResponseControl.java

@ -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);
} }

2
samples/xml/contacts/src/main/java/sample/contact/AddPermissionValidator.java

@ -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())

4
web/src/main/java/org/springframework/security/web/PortMapperImpl.java

@ -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);

2
web/src/main/java/org/springframework/security/web/PortResolverImpl.java

@ -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;

2
web/src/main/java/org/springframework/security/web/access/channel/AbstractRetryEntryPoint.java

@ -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;

4
web/src/main/java/org/springframework/security/web/authentication/LoginUrlAuthenticationEntryPoint.java

@ -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());

2
web/src/main/java/org/springframework/security/web/authentication/rememberme/TokenBasedRememberMeServices.java

@ -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(

2
web/src/main/java/org/springframework/security/web/authentication/www/DigestAuthenticationFilter.java

@ -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

4
web/src/main/java/org/springframework/security/web/savedrequest/FastHttpDateFormat.java

@ -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;
} }
} }

2
web/src/main/java/org/springframework/security/web/util/matcher/ELRequestMatcher.java

@ -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);
} }
/** /**

Loading…
Cancel
Save