Class identity comparisons wherever possible

Issue: SPR-12926
This commit is contained in:
Juergen Hoeller
2015-05-20 14:34:09 +02:00
parent 57e0c789a8
commit b4095c3e1d
108 changed files with 317 additions and 322 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -517,8 +517,9 @@ public abstract class FrameworkPortlet extends GenericPortletBean
// Expose current RequestAttributes to current thread.
RequestAttributes previousRequestAttributes = RequestContextHolder.getRequestAttributes();
PortletRequestAttributes requestAttributes = null;
if (previousRequestAttributes == null || previousRequestAttributes.getClass().equals(PortletRequestAttributes.class) ||
previousRequestAttributes.getClass().equals(ServletRequestAttributes.class)) {
if (previousRequestAttributes == null ||
PortletRequestAttributes.class == previousRequestAttributes.getClass() ||
ServletRequestAttributes.class == previousRequestAttributes.getClass()) {
requestAttributes = new PortletRequestAttributes(request, response);
RequestContextHolder.setRequestAttributes(requestAttributes, this.threadContextInheritable);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -190,7 +190,7 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
return depth;
}
// If we've gone as far as we can go and haven't found it...
if (exceptionClass.equals(Throwable.class)) {
if (exceptionClass == Throwable.class) {
return -1;
}
return getDepth(exceptionMapping, exceptionClass.getSuperclass(), depth + 1);

View File

@@ -520,7 +520,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator
}
private String determineDefaultPhase(Method handlerMethod) {
if (!void.class.equals(handlerMethod.getReturnType())) {
if (void.class != handlerMethod.getReturnType()) {
return PortletRequest.RENDER_PHASE;
}
for (Class<?> argType : handlerMethod.getParameterTypes()) {
@@ -650,7 +650,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator
else if (Principal.class.isAssignableFrom(parameterType)) {
return request.getUserPrincipal();
}
else if (Locale.class.equals(parameterType)) {
else if (Locale.class == parameterType) {
return request.getLocale();
}
else if (InputStream.class.isAssignableFrom(parameterType)) {
@@ -677,7 +677,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator
}
return ((MimeResponse) response).getWriter();
}
else if (Event.class.equals(parameterType)) {
else if (Event.class == parameterType) {
if (!(request instanceof EventRequest)) {
throw new IllegalStateException("Event can only get obtained from EventRequest");
}

View File

@@ -328,7 +328,7 @@ public class AnnotationMethodHandlerExceptionResolver extends AbstractHandlerExc
else if (Principal.class.isAssignableFrom(parameterType)) {
return request.getUserPrincipal();
}
else if (Locale.class.equals(parameterType)) {
else if (Locale.class == parameterType) {
return request.getLocale();
}
else if (InputStream.class.isAssignableFrom(parameterType)) {
@@ -355,7 +355,7 @@ public class AnnotationMethodHandlerExceptionResolver extends AbstractHandlerExc
}
return ((MimeResponse) response).getWriter();
}
else if (Event.class.equals(parameterType)) {
else if (Event.class == parameterType) {
if (!(request instanceof EventRequest)) {
throw new IllegalStateException("Event can only get obtained from EventRequest");
}