Cleanup unnecessary boxing

This commit is contained in:
Lars Grefer 2019-08-01 23:27:18 +02:00 committed by Josh Cummings
parent 2055466ad7
commit 2306d987e9
40 changed files with 158 additions and 159 deletions

View File

@ -100,7 +100,7 @@ public class DefaultPermissionFactory implements PermissionFactory {
Assert.notNull(perm, "Permission required");
Assert.hasText(permissionName, "Permission name required");
Integer mask = Integer.valueOf(perm.getMask());
Integer mask = perm.getMask();
// Ensure no existing Permission uses this integer or code
Assert.isTrue(!registeredPermissionsByInteger.containsKey(mask),
@ -114,10 +114,10 @@ public class DefaultPermissionFactory implements PermissionFactory {
}
public Permission buildFromMask(int mask) {
if (registeredPermissionsByInteger.containsKey(Integer.valueOf(mask))) {
if (registeredPermissionsByInteger.containsKey(mask)) {
// The requested mask has an exact match against a statically-defined
// Permission, so return it
return registeredPermissionsByInteger.get(Integer.valueOf(mask));
return registeredPermissionsByInteger.get(mask);
}
// To get this far, we have to use a CumulativePermission
@ -127,8 +127,7 @@ public class DefaultPermissionFactory implements PermissionFactory {
int permissionToCheck = 1 << i;
if ((mask & permissionToCheck) == permissionToCheck) {
Permission p = registeredPermissionsByInteger.get(Integer
.valueOf(permissionToCheck));
Permission p = registeredPermissionsByInteger.get(permissionToCheck);
if (p == null) {
throw new IllegalStateException("Mask '" + permissionToCheck

View File

@ -593,15 +593,15 @@ public class BasicLookupStrategy implements LookupStrategy {
if (parentId != 0) {
// See if it's already in the "acls"
if (acls.containsKey(new Long(parentId))) {
if (acls.containsKey(parentId)) {
continue; // skip this while iteration
}
// Now try to find it in the cache
MutableAcl cached = aclCache.getFromCache(new Long(parentId));
MutableAcl cached = aclCache.getFromCache(parentId);
if ((cached == null) || !cached.isSidLoaded(sids)) {
parentIdsToLookup.add(new Long(parentId));
parentIdsToLookup.add(parentId);
}
else {
// Pop into the acls map, so our convert method doesn't
@ -627,7 +627,7 @@ public class BasicLookupStrategy implements LookupStrategy {
*/
private void convertCurrentResultIntoObject(Map<Serializable, Acl> acls,
ResultSet rs) throws SQLException {
Long id = new Long(rs.getLong("acl_id"));
Long id = rs.getLong("acl_id");
// If we already have an ACL for this ID, just create the ACE
Acl acl = acls.get(id);
@ -645,7 +645,7 @@ public class BasicLookupStrategy implements LookupStrategy {
long parentAclId = rs.getLong("parent_object");
if (parentAclId != 0) {
parentAcl = new StubAclParent(Long.valueOf(parentAclId));
parentAcl = new StubAclParent(parentAclId);
}
boolean entriesInheriting = rs.getBoolean("entries_inheriting");
@ -662,7 +662,7 @@ public class BasicLookupStrategy implements LookupStrategy {
// It is permissible to have no ACEs in an ACL (which is detected by a null
// ACE_SID)
if (rs.getString("ace_sid") != null) {
Long aceId = new Long(rs.getLong("ace_id"));
Long aceId = rs.getLong("ace_id");
Sid recipient = createSid(rs.getBoolean("ace_principal"),
rs.getString("ace_sid"));

View File

@ -249,14 +249,14 @@ public class JdbcMutableAclService extends JdbcAclService implements MutableAclS
boolean allowCreate) {
List<Long> sidIds = jdbcOperations.queryForList(selectSidPrimaryKey, new Object[] {
Boolean.valueOf(sidIsPrincipal), sidName }, Long.class);
sidIsPrincipal, sidName }, Long.class);
if (!sidIds.isEmpty()) {
return sidIds.get(0);
}
if (allowCreate) {
jdbcOperations.update(insertSid, Boolean.valueOf(sidIsPrincipal), sidName);
jdbcOperations.update(insertSid, sidIsPrincipal, sidName);
Assert.isTrue(TransactionSynchronizationManager.isSynchronizationActive(),
"Transaction must be running");
return jdbcOperations.queryForObject(sidIdentityQuery, Long.class);
@ -410,7 +410,7 @@ public class JdbcMutableAclService extends JdbcAclService implements MutableAclS
Long ownerSid = createOrRetrieveSidPrimaryKey(acl.getOwner(), true);
int count = jdbcOperations.update(updateObjectIdentity, parentId, ownerSid,
Boolean.valueOf(acl.isEntriesInheriting()), acl.getId());
acl.isEntriesInheriting(), acl.getId());
if (count != 1) {
throw new NotFoundException("Unable to locate ACL to update");

View File

@ -71,11 +71,11 @@ public class AccessControlImplEntryTests {
Sid sid = new PrincipalSid("johndoe");
// Create a sample entry
AccessControlEntry ace = new AccessControlEntryImpl(Long.valueOf(1), mockAcl,
AccessControlEntry ace = new AccessControlEntryImpl(1L, mockAcl,
sid, BasePermission.ADMINISTRATION, true, true, true);
// and check every get() method
assertThat(ace.getId()).isEqualTo(new Long(1));
assertThat(ace.getId()).isEqualTo(1L);
assertThat(ace.getAcl()).isEqualTo(mockAcl);
assertThat(ace.getSid()).isEqualTo(sid);
assertThat(ace.isGranting()).isTrue();
@ -92,26 +92,26 @@ public class AccessControlImplEntryTests {
when(mockAcl.getObjectIdentity()).thenReturn(oid);
Sid sid = new PrincipalSid("johndoe");
AccessControlEntry ace = new AccessControlEntryImpl(Long.valueOf(1), mockAcl,
AccessControlEntry ace = new AccessControlEntryImpl(1L, mockAcl,
sid, BasePermission.ADMINISTRATION, true, true, true);
assertThat(ace).isNotNull();
assertThat(ace).isNotEqualTo(Long.valueOf(100));
assertThat(ace).isNotEqualTo(100L);
assertThat(ace).isEqualTo(ace);
assertThat(ace).isEqualTo(new AccessControlEntryImpl(Long.valueOf(1), mockAcl, sid,
assertThat(ace).isEqualTo(new AccessControlEntryImpl(1L, mockAcl, sid,
BasePermission.ADMINISTRATION, true, true, true));
assertThat(ace).isNotEqualTo(new AccessControlEntryImpl(Long.valueOf(2), mockAcl, sid,
assertThat(ace).isNotEqualTo(new AccessControlEntryImpl(2L, mockAcl, sid,
BasePermission.ADMINISTRATION, true, true, true));
assertThat(ace).isNotEqualTo(new AccessControlEntryImpl(Long.valueOf(1), mockAcl,
assertThat(ace).isNotEqualTo(new AccessControlEntryImpl(1L, mockAcl,
new PrincipalSid("scott"), BasePermission.ADMINISTRATION, true, true,
true));
assertThat(ace).isNotEqualTo(new AccessControlEntryImpl(Long.valueOf(1), mockAcl, sid,
assertThat(ace).isNotEqualTo(new AccessControlEntryImpl(1L, mockAcl, sid,
BasePermission.WRITE, true, true, true));
assertThat(ace).isNotEqualTo(new AccessControlEntryImpl(Long.valueOf(1), mockAcl, sid,
assertThat(ace).isNotEqualTo(new AccessControlEntryImpl(1L, mockAcl, sid,
BasePermission.ADMINISTRATION, false, true, true));
assertThat(ace).isNotEqualTo(new AccessControlEntryImpl(Long.valueOf(1), mockAcl, sid,
assertThat(ace).isNotEqualTo(new AccessControlEntryImpl(1L, mockAcl, sid,
BasePermission.ADMINISTRATION, true, false, true));
assertThat(ace).isNotEqualTo(new AccessControlEntryImpl(Long.valueOf(1), mockAcl, sid,
assertThat(ace).isNotEqualTo(new AccessControlEntryImpl(1L, mockAcl, sid,
BasePermission.ADMINISTRATION, true, true, false));
}
}

View File

@ -57,12 +57,12 @@ public class AclImplementationSecurityCheckTests {
auth.setAuthenticated(true);
SecurityContextHolder.getContext().setAuthentication(auth);
ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, new Long(100));
ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, 100L);
AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl(
new SimpleGrantedAuthority("ROLE_OWNERSHIP"), new SimpleGrantedAuthority(
"ROLE_AUDITING"), new SimpleGrantedAuthority("ROLE_GENERAL"));
Acl acl = new AclImpl(identity, new Long(1), aclAuthorizationStrategy,
Acl acl = new AclImpl(identity, 1L, aclAuthorizationStrategy,
new ConsoleAuditLogger());
aclAuthorizationStrategy.securityCheck(acl,
@ -76,7 +76,7 @@ public class AclImplementationSecurityCheckTests {
AclAuthorizationStrategy aclAuthorizationStrategy2 = new AclAuthorizationStrategyImpl(
new SimpleGrantedAuthority("ROLE_ONE"), new SimpleGrantedAuthority(
"ROLE_TWO"), new SimpleGrantedAuthority("ROLE_THREE"));
Acl acl2 = new AclImpl(identity, new Long(1), aclAuthorizationStrategy2,
Acl acl2 = new AclImpl(identity, 1L, aclAuthorizationStrategy2,
new ConsoleAuditLogger());
// Check access in case the principal has no authorization rights
try {
@ -110,7 +110,7 @@ public class AclImplementationSecurityCheckTests {
auth.setAuthenticated(true);
SecurityContextHolder.getContext().setAuthentication(auth);
ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, new Long(100));
ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, 100L);
// Authorization strategy will require a different role for each access
AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl(
new SimpleGrantedAuthority("ROLE_OWNERSHIP"), new SimpleGrantedAuthority(
@ -118,7 +118,7 @@ public class AclImplementationSecurityCheckTests {
// Let's give the principal the ADMINISTRATION permission, without
// granting access
MutableAcl aclFirstDeny = new AclImpl(identity, new Long(1),
MutableAcl aclFirstDeny = new AclImpl(identity, 1L,
aclAuthorizationStrategy, new ConsoleAuditLogger());
aclFirstDeny.insertAce(0, BasePermission.ADMINISTRATION, new PrincipalSid(auth),
false);
@ -160,7 +160,7 @@ public class AclImplementationSecurityCheckTests {
// Create another ACL and give the principal the ADMINISTRATION
// permission, with granting access
MutableAcl aclFirstAllow = new AclImpl(identity, new Long(1),
MutableAcl aclFirstAllow = new AclImpl(identity, 1L,
aclAuthorizationStrategy, new ConsoleAuditLogger());
aclFirstAllow.insertAce(0, BasePermission.ADMINISTRATION, new PrincipalSid(auth),
true);
@ -184,7 +184,7 @@ public class AclImplementationSecurityCheckTests {
}
// Create an ACL with no ACE
MutableAcl aclNoACE = new AclImpl(identity, new Long(1),
MutableAcl aclNoACE = new AclImpl(identity, 1L,
aclAuthorizationStrategy, new ConsoleAuditLogger());
try {
aclAuthorizationStrategy.securityCheck(aclNoACE,

View File

@ -47,7 +47,7 @@ public class ObjectIdentityImplTests {
// Check String-Serializable constructor required field
try {
new ObjectIdentityImpl("", Long.valueOf(1));
new ObjectIdentityImpl("", 1L);
fail("It should have thrown IllegalArgumentException");
}
catch (IllegalArgumentException expected) {
@ -63,7 +63,7 @@ public class ObjectIdentityImplTests {
// The correct way of using String-Serializable constructor
try {
new ObjectIdentityImpl(DOMAIN_CLASS, Long.valueOf(1));
new ObjectIdentityImpl(DOMAIN_CLASS, 1L);
}
catch (IllegalArgumentException notExpected) {
fail("It shouldn't have thrown IllegalArgumentException");
@ -80,8 +80,8 @@ public class ObjectIdentityImplTests {
@Test
public void gettersReturnExpectedValues() throws Exception {
ObjectIdentity obj = new ObjectIdentityImpl(DOMAIN_CLASS, Long.valueOf(1));
assertThat(obj.getIdentifier()).isEqualTo(Long.valueOf(1));
ObjectIdentity obj = new ObjectIdentityImpl(DOMAIN_CLASS, 1L);
assertThat(obj.getIdentifier()).isEqualTo(1L);
assertThat(obj.getType()).isEqualTo(MockIdDomainObject.class.getName());
}
@ -116,7 +116,7 @@ public class ObjectIdentityImplTests {
}
// getId() should return a Serializable object
mockId.setId(new Long(100));
mockId.setId(100L);
try {
new ObjectIdentityImpl(mockId);
}
@ -126,38 +126,38 @@ public class ObjectIdentityImplTests {
@Test(expected = IllegalArgumentException.class)
public void constructorRejectsInvalidTypeParameter() throws Exception {
new ObjectIdentityImpl("", Long.valueOf(1));
new ObjectIdentityImpl("", 1L);
}
@Test
public void testEquals() throws Exception {
ObjectIdentity obj = new ObjectIdentityImpl(DOMAIN_CLASS, Long.valueOf(1));
ObjectIdentity obj = new ObjectIdentityImpl(DOMAIN_CLASS, 1L);
MockIdDomainObject mockObj = new MockIdDomainObject();
mockObj.setId(Long.valueOf(1));
mockObj.setId(1L);
String string = "SOME_STRING";
assertThat(string).isNotSameAs(obj);
assertThat(obj).isNotNull();
assertThat(obj).isNotEqualTo("DIFFERENT_OBJECT_TYPE");
assertThat(obj).isNotEqualTo(new ObjectIdentityImpl(DOMAIN_CLASS, Long.valueOf(2)));
assertThat(obj).isNotEqualTo(new ObjectIdentityImpl(DOMAIN_CLASS, 2L));
assertThat(obj).isNotEqualTo(new ObjectIdentityImpl(
"org.springframework.security.acls.domain.ObjectIdentityImplTests$MockOtherIdDomainObject",
Long.valueOf(1)));
1L));
assertThat(new ObjectIdentityImpl(DOMAIN_CLASS, 1L)).isEqualTo(obj);
assertThat(new ObjectIdentityImpl(mockObj)).isEqualTo(obj);
}
@Test
public void hashcodeIsDifferentForDifferentJavaTypes() throws Exception {
ObjectIdentity obj = new ObjectIdentityImpl(Object.class, Long.valueOf(1));
ObjectIdentity obj2 = new ObjectIdentityImpl(String.class, Long.valueOf(1));
ObjectIdentity obj = new ObjectIdentityImpl(Object.class, 1L);
ObjectIdentity obj2 = new ObjectIdentityImpl(String.class, 1L);
assertThat(obj.hashCode()).isNotEqualTo(obj2.hashCode());
}
@Test
public void longAndIntegerIdsWithSameValueAreEqualAndHaveSameHashcode() {
ObjectIdentity obj = new ObjectIdentityImpl(Object.class, new Long(5));
ObjectIdentity obj2 = new ObjectIdentityImpl(Object.class, Integer.valueOf(5));
ObjectIdentity obj = new ObjectIdentityImpl(Object.class, 5L);
ObjectIdentity obj2 = new ObjectIdentityImpl(Object.class, 5);
assertThat(obj2).isEqualTo(obj);
assertThat(obj2.hashCode()).isEqualTo(obj.hashCode());
@ -174,7 +174,7 @@ public class ObjectIdentityImplTests {
@Test
public void stringAndNumericIdsAreNotEqual() throws Exception {
ObjectIdentity obj = new ObjectIdentityImpl(Object.class, "1000");
ObjectIdentity obj2 = new ObjectIdentityImpl(Object.class, Long.valueOf(1000));
ObjectIdentity obj2 = new ObjectIdentityImpl(Object.class, 1000L);
assertThat(obj).isNotEqualTo(obj2);
}

View File

@ -33,7 +33,7 @@ public class ObjectIdentityRetrievalStrategyImplTests {
@Test
public void testObjectIdentityCreation() throws Exception {
MockIdDomainObject domain = new MockIdDomainObject();
domain.setId(Integer.valueOf(1));
domain.setId(1);
ObjectIdentityRetrievalStrategy retStrategy = new ObjectIdentityRetrievalStrategyImpl();
ObjectIdentity identity = retStrategy.getObjectIdentity(domain);

View File

@ -129,10 +129,10 @@ public abstract class AbstractBasicLookupStrategyTests {
@Test
public void testAclsRetrievalWithDefaultBatchSize() throws Exception {
ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS, new Long(100));
ObjectIdentity middleParentOid = new ObjectIdentityImpl(TARGET_CLASS, new Long(101));
ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS, 100L);
ObjectIdentity middleParentOid = new ObjectIdentityImpl(TARGET_CLASS, 101L);
// Deliberately use an integer for the child, to reproduce bug report in SEC-819
ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS, Integer.valueOf(102));
ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS, 102);
Map<ObjectIdentity, Acl> map = this.strategy
.readAclsById(Arrays.asList(topParentOid, middleParentOid, childOid), null);
@ -141,9 +141,9 @@ public abstract class AbstractBasicLookupStrategyTests {
@Test
public void testAclsRetrievalFromCacheOnly() throws Exception {
ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS, Integer.valueOf(100));
ObjectIdentity middleParentOid = new ObjectIdentityImpl(TARGET_CLASS, new Long(101));
ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS, new Long(102));
ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS, 100);
ObjectIdentity middleParentOid = new ObjectIdentityImpl(TARGET_CLASS, 101L);
ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS, 102L);
// Objects were put in cache
strategy.readAclsById(Arrays.asList(topParentOid, middleParentOid, childOid), null);
@ -158,9 +158,9 @@ public abstract class AbstractBasicLookupStrategyTests {
@Test
public void testAclsRetrievalWithCustomBatchSize() throws Exception {
ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS, new Long(100));
ObjectIdentity middleParentOid = new ObjectIdentityImpl(TARGET_CLASS, Integer.valueOf(101));
ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS, new Long(102));
ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS, 100L);
ObjectIdentity middleParentOid = new ObjectIdentityImpl(TARGET_CLASS, 101);
ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS, 102L);
// Set a batch size to allow multiple database queries in order to retrieve all
// acls
@ -242,10 +242,10 @@ public abstract class AbstractBasicLookupStrategyTests {
String query = "INSERT INTO acl_object_identity(ID,OBJECT_ID_CLASS,OBJECT_ID_IDENTITY,PARENT_OBJECT,OWNER_SID,ENTRIES_INHERITING) VALUES (6,2,103,1,1,1);";
getJdbcTemplate().execute(query);
ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(100));
ObjectIdentity middleParentOid = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(101));
ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(102));
ObjectIdentity middleParent2Oid = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(103));
ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS, 100L);
ObjectIdentity middleParentOid = new ObjectIdentityImpl(TARGET_CLASS, 101L);
ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS, 102L);
ObjectIdentity middleParent2Oid = new ObjectIdentityImpl(TARGET_CLASS, 103L);
// Retrieve the child
Map<ObjectIdentity, Acl> map = this.strategy.readAclsById(Arrays.asList(childOid), null);
@ -274,10 +274,10 @@ public abstract class AbstractBasicLookupStrategyTests {
+ "INSERT INTO acl_entry(ID,ACL_OBJECT_IDENTITY,ACE_ORDER,SID,MASK,GRANTING,AUDIT_SUCCESS,AUDIT_FAILURE) VALUES (7,6,0,1,1,1,0,0)";
getJdbcTemplate().execute(query);
ObjectIdentity grandParentOid = new ObjectIdentityImpl(TARGET_CLASS, new Long(104));
ObjectIdentity parent1Oid = new ObjectIdentityImpl(TARGET_CLASS, new Long(105));
ObjectIdentity parent2Oid = new ObjectIdentityImpl(TARGET_CLASS, Integer.valueOf(106));
ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS, Integer.valueOf(107));
ObjectIdentity grandParentOid = new ObjectIdentityImpl(TARGET_CLASS, 104L);
ObjectIdentity parent1Oid = new ObjectIdentityImpl(TARGET_CLASS, 105L);
ObjectIdentity parent2Oid = new ObjectIdentityImpl(TARGET_CLASS, 106);
ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS, 107);
// First lookup only child, thus populating the cache with grandParent,
// parent1
@ -317,7 +317,7 @@ public abstract class AbstractBasicLookupStrategyTests {
getJdbcTemplate().execute(query);
ObjectIdentity oid = new ObjectIdentityImpl(TARGET_CLASS, new Long(104));
ObjectIdentity oid = new ObjectIdentityImpl(TARGET_CLASS, 104L);
strategy.readAclsById(Arrays.asList(oid), Arrays.asList(BEN_SID));
}

View File

@ -101,7 +101,7 @@ public class BasicLookupStrategyWithAclClassTypeTests extends AbstractBasicLooku
@Test
public void testReadObjectIdentityUsingLongTypeWithConversionServiceEnabled() {
ObjectIdentity oid = new ObjectIdentityImpl(TARGET_CLASS, new Long(100));
ObjectIdentity oid = new ObjectIdentityImpl(TARGET_CLASS, 100L);
Map<ObjectIdentity, Acl> foundAcls = uuidEnabledStrategy.readAclsById(Arrays.asList(oid), Arrays.asList(BEN_SID));
Assert.assertEquals(1, foundAcls.size());
Assert.assertNotNull(foundAcls.get(oid));

View File

@ -71,12 +71,12 @@ public class EhCacheBasedAclCacheTests {
new ConsoleAuditLogger()), new AclAuthorizationStrategyImpl(
new SimpleGrantedAuthority("ROLE_USER")));
ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(100));
ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, 100L);
AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl(
new SimpleGrantedAuthority("ROLE_OWNERSHIP"), new SimpleGrantedAuthority(
"ROLE_AUDITING"), new SimpleGrantedAuthority("ROLE_GENERAL"));
acl = new AclImpl(identity, Long.valueOf(1), aclAuthorizationStrategy,
acl = new AclImpl(identity, 1L, aclAuthorizationStrategy,
new ConsoleAuditLogger());
}
@ -188,11 +188,11 @@ public class EhCacheBasedAclCacheTests {
SecurityContextHolder.getContext().setAuthentication(auth);
ObjectIdentity identityParent = new ObjectIdentityImpl(TARGET_CLASS,
Long.valueOf(2));
2L);
AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl(
new SimpleGrantedAuthority("ROLE_OWNERSHIP"), new SimpleGrantedAuthority(
"ROLE_AUDITING"), new SimpleGrantedAuthority("ROLE_GENERAL"));
MutableAcl parentAcl = new AclImpl(identityParent, Long.valueOf(2),
MutableAcl parentAcl = new AclImpl(identityParent, 2L,
aclAuthorizationStrategy, new ConsoleAuditLogger());
acl.setParent(parentAcl);

View File

@ -78,11 +78,11 @@ public class JdbcMutableAclServiceTests extends
// ================================================================================================
private final ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS,
Long.valueOf(100));
100L);
private final ObjectIdentity middleParentOid = new ObjectIdentityImpl(TARGET_CLASS,
Long.valueOf(101));
101L);
private final ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS,
Long.valueOf(102));
102L);
@Autowired
private JdbcMutableAclService jdbcMutableAclService;
@ -361,7 +361,7 @@ public class JdbcMutableAclServiceTests extends
public void createAclForADuplicateDomainObject() throws Exception {
SecurityContextHolder.getContext().setAuthentication(auth);
ObjectIdentity duplicateOid = new ObjectIdentityImpl(TARGET_CLASS,
Long.valueOf(100));
100L);
jdbcMutableAclService.createAcl(duplicateOid);
// Try to add the same object second time
try {
@ -428,7 +428,7 @@ public class JdbcMutableAclServiceTests extends
// Check the cache
assertThat(aclCache.getFromCache(getChildOid())).isNull();
assertThat(aclCache.getFromCache(Long.valueOf(102))).isNull();
assertThat(aclCache.getFromCache(102L)).isNull();
}
/** SEC-1107 */
@ -436,11 +436,11 @@ public class JdbcMutableAclServiceTests extends
@Transactional
public void identityWithIntegerIdIsSupportedByCreateAcl() throws Exception {
SecurityContextHolder.getContext().setAuthentication(auth);
ObjectIdentity oid = new ObjectIdentityImpl(TARGET_CLASS, Integer.valueOf(101));
ObjectIdentity oid = new ObjectIdentityImpl(TARGET_CLASS, 101);
jdbcMutableAclService.createAcl(oid);
assertThat(jdbcMutableAclService.readAclById(new ObjectIdentityImpl(
TARGET_CLASS, Long.valueOf(101)))).isNotNull();
TARGET_CLASS, 101L))).isNotNull();
}
/**
@ -454,8 +454,8 @@ public class JdbcMutableAclServiceTests extends
auth.setAuthenticated(true);
SecurityContextHolder.getContext().setAuthentication(auth);
ObjectIdentity parentOid = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(104));
ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(105));
ObjectIdentity parentOid = new ObjectIdentityImpl(TARGET_CLASS, 104L);
ObjectIdentity childOid = new ObjectIdentityImpl(TARGET_CLASS, 105L);
MutableAcl parent = jdbcMutableAclService.createAcl(parentOid);
MutableAcl child = jdbcMutableAclService.createAcl(childOid);
@ -491,11 +491,11 @@ public class JdbcMutableAclServiceTests extends
"ROLE_IGNORED");
SecurityContextHolder.getContext().setAuthentication(auth);
ObjectIdentityImpl rootObject = new ObjectIdentityImpl(TARGET_CLASS,
Long.valueOf(1));
1L);
MutableAcl parent = jdbcMutableAclService.createAcl(rootObject);
MutableAcl child = jdbcMutableAclService.createAcl(new ObjectIdentityImpl(
TARGET_CLASS, Long.valueOf(2)));
TARGET_CLASS, 2L));
child.setParent(parent);
jdbcMutableAclService.updateAcl(child);
@ -507,7 +507,7 @@ public class JdbcMutableAclServiceTests extends
jdbcMutableAclService.updateAcl(parent);
child = (MutableAcl) jdbcMutableAclService.readAclById(new ObjectIdentityImpl(
TARGET_CLASS, Long.valueOf(2)));
TARGET_CLASS, 2L));
parent = (MutableAcl) child.getParentAcl();
@ -528,7 +528,7 @@ public class JdbcMutableAclServiceTests extends
SecurityContextHolder.getContext().setAuthentication(auth);
ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS,
Long.valueOf(110));
110L);
MutableAcl topParent = jdbcMutableAclService.createAcl(topParentOid);
// Add an ACE permission entry

View File

@ -74,7 +74,7 @@ public class SpringCacheBasedAclCacheTests {
public void cacheOperationsAclWithoutParent() throws Exception {
Cache cache = getCache();
Map realCache = (Map) cache.getNativeCache();
ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(100));
ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, 100L);
AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl(
new SimpleGrantedAuthority("ROLE_OWNERSHIP"), new SimpleGrantedAuthority(
"ROLE_AUDITING"), new SimpleGrantedAuthority("ROLE_GENERAL"));
@ -84,33 +84,33 @@ public class SpringCacheBasedAclCacheTests {
auditLogger);
SpringCacheBasedAclCache myCache = new SpringCacheBasedAclCache(cache,
permissionGrantingStrategy, aclAuthorizationStrategy);
MutableAcl acl = new AclImpl(identity, Long.valueOf(1), aclAuthorizationStrategy,
MutableAcl acl = new AclImpl(identity, 1L, aclAuthorizationStrategy,
auditLogger);
assertThat(realCache).isEmpty();
myCache.putInCache(acl);
// Check we can get from cache the same objects we put in
assertThat(acl).isEqualTo(myCache.getFromCache(Long.valueOf(1)));
assertThat(acl).isEqualTo(myCache.getFromCache(1L));
assertThat(acl).isEqualTo(myCache.getFromCache(identity));
// Put another object in cache
ObjectIdentity identity2 = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(101));
MutableAcl acl2 = new AclImpl(identity2, Long.valueOf(2),
ObjectIdentity identity2 = new ObjectIdentityImpl(TARGET_CLASS, 101L);
MutableAcl acl2 = new AclImpl(identity2, 2L,
aclAuthorizationStrategy, new ConsoleAuditLogger());
myCache.putInCache(acl2);
// Try to evict an entry that doesn't exist
myCache.evictFromCache(Long.valueOf(3));
myCache.evictFromCache(new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(102)));
myCache.evictFromCache(3L);
myCache.evictFromCache(new ObjectIdentityImpl(TARGET_CLASS, 102L));
assertThat(realCache).hasSize(4);
myCache.evictFromCache(Long.valueOf(1));
myCache.evictFromCache(1L);
assertThat(realCache).hasSize(2);
// Check the second object inserted
assertThat(acl2).isEqualTo(myCache.getFromCache(Long.valueOf(2)));
assertThat(acl2).isEqualTo(myCache.getFromCache(2L));
assertThat(acl2).isEqualTo(myCache.getFromCache(identity2));
myCache.evictFromCache(identity2);
@ -128,9 +128,9 @@ public class SpringCacheBasedAclCacheTests {
auth.setAuthenticated(true);
SecurityContextHolder.getContext().setAuthentication(auth);
ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(1));
ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, 1L);
ObjectIdentity identityParent = new ObjectIdentityImpl(TARGET_CLASS,
Long.valueOf(2));
2L);
AclAuthorizationStrategy aclAuthorizationStrategy = new AclAuthorizationStrategyImpl(
new SimpleGrantedAuthority("ROLE_OWNERSHIP"), new SimpleGrantedAuthority(
"ROLE_AUDITING"), new SimpleGrantedAuthority("ROLE_GENERAL"));
@ -141,9 +141,9 @@ public class SpringCacheBasedAclCacheTests {
SpringCacheBasedAclCache myCache = new SpringCacheBasedAclCache(cache,
permissionGrantingStrategy, aclAuthorizationStrategy);
MutableAcl acl = new AclImpl(identity, Long.valueOf(1), aclAuthorizationStrategy,
MutableAcl acl = new AclImpl(identity, 1L, aclAuthorizationStrategy,
auditLogger);
MutableAcl parentAcl = new AclImpl(identityParent, Long.valueOf(2),
MutableAcl parentAcl = new AclImpl(identityParent, 2L,
aclAuthorizationStrategy, auditLogger);
acl.setParent(parentAcl);
@ -153,7 +153,7 @@ public class SpringCacheBasedAclCacheTests {
assertThat(4).isEqualTo(realCache.size());
// Check we can get from cache the same objects we put in
AclImpl aclFromCache = (AclImpl) myCache.getFromCache(Long.valueOf(1));
AclImpl aclFromCache = (AclImpl) myCache.getFromCache(1L);
assertThat(aclFromCache).isEqualTo(acl);
// SEC-951 check transient fields are set on parent
assertThat(FieldUtils.getFieldValue(aclFromCache.getParentAcl(),
@ -162,7 +162,7 @@ public class SpringCacheBasedAclCacheTests {
"permissionGrantingStrategy")).isNotNull();
assertThat(myCache.getFromCache(identity)).isEqualTo(acl);
assertThat(FieldUtils.getFieldValue(aclFromCache, "aclAuthorizationStrategy")).isNotNull();
AclImpl parentAclFromCache = (AclImpl) myCache.getFromCache(Long.valueOf(2));
AclImpl parentAclFromCache = (AclImpl) myCache.getFromCache(2L);
assertThat(parentAclFromCache).isEqualTo(parentAcl);
assertThat(FieldUtils.getFieldValue(parentAclFromCache,
"aclAuthorizationStrategy")).isNotNull();

View File

@ -442,8 +442,8 @@ class HttpConfigurationBuilder {
if (sessionFixationProtectionRequired) {
sessionFixationStrategy.addPropertyValue("migrateSessionAttributes",
Boolean.valueOf(sessionFixationAttribute
.equals(OPT_SESSION_FIXATION_MIGRATE_SESSION)));
sessionFixationAttribute
.equals(OPT_SESSION_FIXATION_MIGRATE_SESSION));
}
}

View File

@ -131,14 +131,14 @@ public class LdapUserServiceBeanDefinitionParser extends
BeanDefinition bd = registry
.getBeanDefinition(BeanIds.CONTEXT_SOURCE_SETTING_POST_PROCESSOR);
bd.getPropertyValues().addPropertyValue("defaultNameRequired",
Boolean.valueOf(defaultNameRequired));
defaultNameRequired);
}
return;
}
BeanDefinitionBuilder bdb = BeanDefinitionBuilder
.rootBeanDefinition(ContextSourceSettingPostProcessor.class);
bdb.addPropertyValue("defaultNameRequired", Boolean.valueOf(defaultNameRequired));
bdb.addPropertyValue("defaultNameRequired", defaultNameRequired);
registry.registerBeanDefinition(BeanIds.CONTEXT_SOURCE_SETTING_POST_PROCESSOR,
bdb.getBeanDefinition());
}

View File

@ -29,7 +29,7 @@ public class TargetObject implements ITargetObject {
// ========================================================================================================
public Integer computeHashCode(String input) {
return Integer.valueOf(input.hashCode());
return input.hashCode();
}
public int countLength(String input) {

View File

@ -76,7 +76,7 @@ public class SecurityConfigTests {
MockConfigAttribute mock2 = new MockConfigAttribute("NOT_EQUAL");
assertThat(security1).isNotEqualTo(mock2);
Integer int1 = Integer.valueOf(987);
Integer int1 = 987;
assertThat(security1).isNotEqualTo(int1);
}

View File

@ -103,7 +103,7 @@ public class AfterInvocationProviderManagerTests {
List list = new Vector();
list.add(new MockAfterInvocationProvider("swap1", MethodInvocation.class,
new SecurityConfig("GIVE_ME_SWAP1")));
list.add(Integer.valueOf(45));
list.add(45);
list.add(new MockAfterInvocationProvider("swap3", MethodInvocation.class,
new SecurityConfig("GIVE_ME_SWAP3")));

View File

@ -111,7 +111,7 @@ public class AbstractAuthenticationTokenTests {
assertThat(!token1.equals(token7)).isTrue();
assertThat(!token7.equals(token1)).isTrue();
assertThat(!token1.equals(Integer.valueOf(100))).isTrue();
assertThat(!token1.equals(100)).isTrue();
}
@Test

View File

@ -42,7 +42,7 @@ public class SimpleGrantedAuthorityTests {
assertThat(auth1.equals(mock(GrantedAuthority.class))).isFalse();
assertThat(auth1.equals(Integer.valueOf(222))).isFalse();
assertThat(auth1.equals(222)).isFalse();
}
@Test

View File

@ -38,7 +38,7 @@ public class KeyBasedPersistenceTokenServiceTests {
SecureRandomFactoryBean fb = new SecureRandomFactoryBean();
KeyBasedPersistenceTokenService service = new KeyBasedPersistenceTokenService();
service.setServerSecret("MY:SECRET$$$#");
service.setServerInteger(Integer.valueOf(454545));
service.setServerInteger(454545);
try {
SecureRandom rnd = fb.getObject();
service.setSecureRandom(rnd);

View File

@ -110,7 +110,7 @@ public class SpringSecurityLdapTemplate extends LdapTemplate {
NamingEnumeration<SearchResult> results = ctx.search(dn,
comparisonFilter, new Object[] { value }, ctls);
Boolean match = Boolean.valueOf(results.hasMore());
Boolean match = results.hasMore();
LdapUtils.closeEnumeration(results);
return match;

View File

@ -310,7 +310,7 @@ public class PasswordPolicyResponseControl extends PasswordPolicyControl {
}
private void setInChoice(boolean inChoice) {
this.inChoice = Boolean.valueOf(inChoice);
this.inChoice = inChoice;
}
}
}

View File

@ -152,7 +152,7 @@ public class OAuth2AccessTokenResponseHttpMessageConverter extends AbstractHttpM
long expiresIn = 0;
if (tokenResponseParameters.containsKey(OAuth2ParameterNames.EXPIRES_IN)) {
try {
expiresIn = Long.valueOf(tokenResponseParameters.get(OAuth2ParameterNames.EXPIRES_IN));
expiresIn = Long.parseLong(tokenResponseParameters.get(OAuth2ParameterNames.EXPIRES_IN));
} catch (NumberFormatException ex) { }
}

View File

@ -70,7 +70,7 @@ public class AddDeleteContactController {
@RequestMapping(value = "/secure/del.htm", method = RequestMethod.GET)
public ModelAndView delContact(@RequestParam("contactId") int contactId) {
Contact contact = contactManager.getById(Long.valueOf(contactId));
Contact contact = contactManager.getById((long) contactId);
contactManager.delete(contact);
return new ModelAndView("deleted", "contact", contact);

View File

@ -68,7 +68,7 @@ public final class AdminPermissionController implements MessageSourceAware {
*/
@RequestMapping(value = "/secure/adminPermission.htm", method = RequestMethod.GET)
public ModelAndView displayAdminPage(@RequestParam("contactId") int contactId) {
Contact contact = contactManager.getById(Long.valueOf(contactId));
Contact contact = contactManager.getById((long) contactId);
Acl acl = aclService.readAclById(new ObjectIdentityImpl(contact));
Map<String, Object> model = new HashMap<>();
@ -161,11 +161,11 @@ public final class AdminPermissionController implements MessageSourceAware {
private Map<Integer, String> listPermissions() {
Map<Integer, String> map = new LinkedHashMap<>();
map.put(Integer.valueOf(BasePermission.ADMINISTRATION.getMask()),
map.put(BasePermission.ADMINISTRATION.getMask(),
messages.getMessage("select.administer", "Administer"));
map.put(Integer.valueOf(BasePermission.READ.getMask()),
map.put(BasePermission.READ.getMask(),
messages.getMessage("select.read", "Read"));
map.put(Integer.valueOf(BasePermission.DELETE.getMask()),
map.put(BasePermission.DELETE.getMask(),
messages.getMessage("select.delete", "Delete"));
return map;

View File

@ -84,7 +84,7 @@ public class ContactManagerBackend extends ApplicationObjectSupport implements
public void create(Contact contact) {
// Create the Contact itself
contact.setId(Long.valueOf(counter++));
contact.setId((long) counter++);
contactDao.create(contact);
// Grant the current principal administrative permission to the contact

View File

@ -165,7 +165,7 @@ public class DataSourcePopulator implements InitializingBean {
// Create acl_object_identity rows (and also acl_class rows as needed
for (int i = 1; i < createEntities; i++) {
final ObjectIdentity objectIdentity = new ObjectIdentityImpl(Contact.class,
Long.valueOf(i));
(long) i);
tt.execute(new TransactionCallback<Object>() {
public Object doInTransaction(TransactionStatus arg0) {
mutableAclService.createAcl(objectIdentity);
@ -230,7 +230,7 @@ public class DataSourcePopulator implements InitializingBean {
private void changeOwner(int contactNumber, String newOwnerUsername) {
AclImpl acl = (AclImpl) mutableAclService.readAclById(new ObjectIdentityImpl(
Contact.class, new Long(contactNumber)));
Contact.class, (long) contactNumber));
acl.setOwner(new PrincipalSid(newOwnerUsername));
updateAclInTransaction(acl);
}
@ -242,7 +242,7 @@ public class DataSourcePopulator implements InitializingBean {
private void grantPermissions(int contactNumber, String recipientUsername,
Permission permission) {
AclImpl acl = (AclImpl) mutableAclService.readAclById(new ObjectIdentityImpl(
Contact.class, Long.valueOf(contactNumber)));
Contact.class, (long) contactNumber));
acl.insertAce(acl.getEntries().size(), permission, new PrincipalSid(
recipientUsername), true);
updateAclInTransaction(acl);

View File

@ -92,10 +92,10 @@ public class IndexController {
Authentication user = SecurityContextHolder.getContext().getAuthentication();
for (Contact contact : myContactsList) {
hasDelete.put(contact, Boolean.valueOf(permissionEvaluator.hasPermission(
user, contact, HAS_DELETE)));
hasAdmin.put(contact, Boolean.valueOf(permissionEvaluator.hasPermission(user,
contact, HAS_ADMIN)));
hasDelete.put(contact, permissionEvaluator.hasPermission(
user, contact, HAS_DELETE));
hasAdmin.put(contact, permissionEvaluator.hasPermission(user,
contact, HAS_ADMIN));
}
Map<String, Object> model = new HashMap<>();

View File

@ -55,7 +55,7 @@ public class ContactManagerTests {
void assertContainsContact(long id, List<Contact> contacts) {
for (Contact contact : contacts) {
if (contact.getId().equals(Long.valueOf(id))) {
if (contact.getId().equals(id)) {
return;
}
}
@ -65,7 +65,7 @@ public class ContactManagerTests {
void assertDoestNotContainContact(long id, List<Contact> contacts) {
for (Contact contact : contacts) {
if (contact.getId().equals(Long.valueOf(id))) {
if (contact.getId().equals(id)) {
fail("List of contact should NOT (but did) contain: " + id);
}
}
@ -148,7 +148,7 @@ public class ContactManagerTests {
assertDoestNotContainContact(5, contacts);
Contact c1 = contactManager.getById(new Long(4));
Contact c1 = contactManager.getById(4L);
contactManager.deletePermission(c1, new PrincipalSid("bob"),
BasePermission.ADMINISTRATION);

View File

@ -40,7 +40,7 @@ public abstract class AbstractElement {
protected AbstractElement() {
this.name = "/";
this.parent = null;
this.id = Long.valueOf(-1);
this.id = -1L;
}
/**

View File

@ -83,18 +83,18 @@ public class DocumentDaoImpl extends JdbcDaoSupport implements DocumentDao {
new Object[] { id }, new RowMapper<Directory>() {
public Directory mapRow(ResultSet rs, int rowNumber)
throws SQLException {
Long parentDirectoryId = new Long(rs
.getLong("parent_directory_id"));
Long parentDirectoryId = rs
.getLong("parent_directory_id");
Directory parentDirectory = Directory.ROOT_DIRECTORY;
if (parentDirectoryId != null
&& !parentDirectoryId.equals(new Long(-1))) {
&& !parentDirectoryId.equals(-1L)) {
// Need to go and lookup the parent, so do that first
parentDirectory = getDirectoryWithImmediateParentPopulated(parentDirectoryId);
}
Directory directory = new Directory(rs
.getString("directory_name"), parentDirectory);
FieldUtils.setProtectedFieldValue("id", directory,
new Long(rs.getLong("id")));
rs.getLong("id"));
return directory;
}
});
@ -108,8 +108,8 @@ public class DocumentDaoImpl extends JdbcDaoSupport implements DocumentDao {
SELECT_FROM_DIRECTORY_NULL, new RowMapper<Directory>() {
public Directory mapRow(ResultSet rs, int rowNumber)
throws SQLException {
return getDirectoryWithImmediateParentPopulated(new Long(rs
.getLong("id")));
return getDirectoryWithImmediateParentPopulated(rs
.getLong("id"));
}
});
return directories.toArray(new AbstractElement[] {});
@ -119,22 +119,22 @@ public class DocumentDaoImpl extends JdbcDaoSupport implements DocumentDao {
new RowMapper<AbstractElement>() {
public Directory mapRow(ResultSet rs, int rowNumber)
throws SQLException {
return getDirectoryWithImmediateParentPopulated(new Long(rs
.getLong("id")));
return getDirectoryWithImmediateParentPopulated(rs
.getLong("id"));
}
});
List<File> files = getJdbcTemplate().query(SELECT_FROM_FILE,
new Object[] { directory.getId() }, new RowMapper<File>() {
public File mapRow(ResultSet rs, int rowNumber) throws SQLException {
Long parentDirectoryId = new Long(rs
.getLong("parent_directory_id"));
Long parentDirectoryId = rs
.getLong("parent_directory_id");
Directory parentDirectory = null;
if (parentDirectoryId != null) {
parentDirectory = getDirectoryWithImmediateParentPopulated(parentDirectoryId);
}
File file = new File(rs.getString("file_name"), parentDirectory);
FieldUtils.setProtectedFieldValue("id", file,
new Long(rs.getLong("id")));
rs.getLong("id"));
return file;
}
});

View File

@ -150,7 +150,7 @@ public class AuthenticationTag extends TagSupport {
* Set HTML escaping for this tag, as boolean value.
*/
public void setHtmlEscape(String htmlEscape) throws JspException {
this.htmlEscape = Boolean.valueOf(htmlEscape);
this.htmlEscape = Boolean.parseBoolean(htmlEscape);
}
/**

View File

@ -42,8 +42,8 @@ public class PortMapperImpl implements PortMapper {
public PortMapperImpl() {
this.httpsPortMappings = new HashMap<>();
this.httpsPortMappings.put(Integer.valueOf(80), Integer.valueOf(443));
this.httpsPortMappings.put(Integer.valueOf(8080), Integer.valueOf(8443));
this.httpsPortMappings.put(80, 443);
this.httpsPortMappings.put(8080, 8443);
}
// ~ Methods

View File

@ -54,11 +54,11 @@ public class PortResolverImpl implements PortResolver {
String scheme = request.getScheme().toLowerCase();
if ("http".equals(scheme)) {
portLookup = portMapper.lookupHttpPort(Integer.valueOf(serverPort));
portLookup = portMapper.lookupHttpPort(serverPort);
}
else if ("https".equals(scheme)) {
portLookup = portMapper.lookupHttpsPort(Integer.valueOf(serverPort));
portLookup = portMapper.lookupHttpsPort(serverPort);
}
if (portLookup != null) {

View File

@ -63,7 +63,7 @@ public abstract class AbstractRetryEntryPoint implements ChannelEntryPoint {
String redirectUrl = request.getRequestURI()
+ ((queryString == null) ? "" : ("?" + queryString));
Integer currentPort = Integer.valueOf(portResolver.getServerPort(request));
Integer currentPort = portResolver.getServerPort(request);
Integer redirectPort = getMappedPort(currentPort);
if (redirectPort != null) {

View File

@ -191,7 +191,7 @@ public class LoginUrlAuthenticationEntryPoint implements AuthenticationEntryPoin
urlBuilder.setPathInfo(loginForm);
if (forceHttps && "http".equals(scheme)) {
Integer httpsPort = portMapper.lookupHttpsPort(Integer.valueOf(serverPort));
Integer httpsPort = portMapper.lookupHttpsPort(serverPort);
if (httpsPort != null) {
// Overwrite scheme and port in the redirect URL
@ -215,7 +215,7 @@ public class LoginUrlAuthenticationEntryPoint implements AuthenticationEntryPoin
throws IOException, ServletException {
int serverPort = portResolver.getServerPort(request);
Integer httpsPort = portMapper.lookupHttpsPort(Integer.valueOf(serverPort));
Integer httpsPort = portMapper.lookupHttpsPort(serverPort);
if (httpsPort != null) {
RedirectUrlBuilder urlBuilder = new RedirectUrlBuilder();

View File

@ -152,7 +152,7 @@ public class ConcurrentSessionControlAuthenticationStrategy implements
if (exceptionIfMaximumExceeded || (sessions == null)) {
throw new SessionAuthenticationException(messages.getMessage(
"ConcurrentSessionControlAuthenticationStrategy.exceededAllowed",
new Object[] { Integer.valueOf(allowableSessions) },
new Object[] {allowableSessions},
"Maximum sessions of {0} for this principal exceeded"));
}

View File

@ -234,8 +234,8 @@ public class DefaultSavedRequest implements SavedRequest {
return false;
}
if (!propertyEquals("serverPort", Integer.valueOf(this.serverPort),
Integer.valueOf(portResolver.getServerPort(request)))) {
if (!propertyEquals("serverPort", this.serverPort,
portResolver.getServerPort(request))) {
return false;
}

View File

@ -85,7 +85,7 @@ public class FastHttpDateFormat {
*/
public static String formatDate(long value, DateFormat threadLocalformat) {
String cachedDate = null;
Long longValue = Long.valueOf(value);
Long longValue = value;
try {
cachedDate = formatCache.get(longValue);
@ -160,7 +160,7 @@ public class FastHttpDateFormat {
return null;
}
return new Long(date.getTime());
return date.getTime();
}
/**

View File

@ -36,14 +36,14 @@ public class PortMapperImplTests {
@Test
public void testDefaultMappingsAreKnown() throws Exception {
PortMapperImpl portMapper = new PortMapperImpl();
assertThat(portMapper.lookupHttpPort(Integer.valueOf(443))).isEqualTo(
assertThat(portMapper.lookupHttpPort(443)).isEqualTo(
Integer.valueOf(80));
assertThat(Integer.valueOf(8080)).isEqualTo(
portMapper.lookupHttpPort(Integer.valueOf(8443)));
portMapper.lookupHttpPort(8443));
assertThat(Integer.valueOf(443)).isEqualTo(
portMapper.lookupHttpsPort(Integer.valueOf(80)));
portMapper.lookupHttpsPort(80));
assertThat(Integer.valueOf(8443)).isEqualTo(
portMapper.lookupHttpsPort(Integer.valueOf(8080)));
portMapper.lookupHttpsPort(8080));
}
@Test
@ -107,9 +107,9 @@ public class PortMapperImplTests {
portMapper.setPortMappings(map);
assertThat(portMapper.lookupHttpPort(Integer.valueOf(442))).isEqualTo(
assertThat(portMapper.lookupHttpPort(442)).isEqualTo(
Integer.valueOf(79));
assertThat(Integer.valueOf(442)).isEqualTo(
portMapper.lookupHttpsPort(Integer.valueOf(79)));
portMapper.lookupHttpsPort(79));
}
}