Cleanup unnecessary boxing
This commit is contained in:
committed by
Josh Cummings
parent
2055466ad7
commit
2306d987e9
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+1
-1
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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();
|
||||
|
||||
+1
-1
@@ -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"));
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user