diff options
author | Matthew Tambara | 2016-06-28 21:57:36 +0000 |
---|---|---|
committer | Matthew Tambara | 2016-06-28 23:18:39 +0000 |
commit | eb6d8cb3028527b415c0d8cecb07812ab61e263e (patch) | |
tree | ab8c008a097082e1c3018c3ec5a31b17356d8123 | |
parent | 94e335c22b564a8daaa0fe1816aa0646f494ae5b (diff) | |
download | rt.equinox.bundles-eb6d8cb3028527b415c0d8cecb07812ab61e263e.tar.gz rt.equinox.bundles-eb6d8cb3028527b415c0d8cecb07812ab61e263e.tar.xz rt.equinox.bundles-eb6d8cb3028527b415c0d8cecb07812ab61e263e.zip |
LPS-66881 Use Set instead of array
Signed-off-by: Matthew Tambara <matthew.tambara@liferay.com>
-rw-r--r-- | bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpServletRequestWrapperImpl.java | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpServletRequestWrapperImpl.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpServletRequestWrapperImpl.java index 50e63d867..9ef4797bd 100644 --- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpServletRequestWrapperImpl.java +++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/servlet/HttpServletRequestWrapperImpl.java @@ -26,24 +26,26 @@ public class HttpServletRequestWrapperImpl extends HttpServletRequestWrapper { private final Stack<DispatchTargets> dispatchTargets = new Stack<DispatchTargets>(); private final HttpServletRequest request; - private static final String[] dispatcherAttributes = new String[] { - RequestDispatcher.ERROR_EXCEPTION, - RequestDispatcher.ERROR_EXCEPTION_TYPE, - RequestDispatcher.ERROR_MESSAGE, - RequestDispatcher.ERROR_REQUEST_URI, - RequestDispatcher.ERROR_SERVLET_NAME, - RequestDispatcher.ERROR_STATUS_CODE, - RequestDispatcher.FORWARD_CONTEXT_PATH, - RequestDispatcher.FORWARD_PATH_INFO, - RequestDispatcher.FORWARD_QUERY_STRING, - RequestDispatcher.FORWARD_REQUEST_URI, - RequestDispatcher.FORWARD_SERVLET_PATH, - RequestDispatcher.INCLUDE_CONTEXT_PATH, - RequestDispatcher.INCLUDE_PATH_INFO, - RequestDispatcher.INCLUDE_QUERY_STRING, - RequestDispatcher.INCLUDE_REQUEST_URI, - RequestDispatcher.INCLUDE_SERVLET_PATH - }; + private static final Set<String> dispatcherAttributes = new HashSet<String>(); + + static { + dispatcherAttributes.add(RequestDispatcher.ERROR_EXCEPTION); + dispatcherAttributes.add(RequestDispatcher.ERROR_EXCEPTION_TYPE); + dispatcherAttributes.add(RequestDispatcher.ERROR_MESSAGE); + dispatcherAttributes.add(RequestDispatcher.ERROR_REQUEST_URI); + dispatcherAttributes.add(RequestDispatcher.ERROR_SERVLET_NAME); + dispatcherAttributes.add(RequestDispatcher.ERROR_STATUS_CODE); + dispatcherAttributes.add(RequestDispatcher.FORWARD_CONTEXT_PATH); + dispatcherAttributes.add(RequestDispatcher.FORWARD_PATH_INFO); + dispatcherAttributes.add(RequestDispatcher.FORWARD_QUERY_STRING); + dispatcherAttributes.add(RequestDispatcher.FORWARD_REQUEST_URI); + dispatcherAttributes.add(RequestDispatcher.FORWARD_SERVLET_PATH); + dispatcherAttributes.add(RequestDispatcher.INCLUDE_CONTEXT_PATH); + dispatcherAttributes.add(RequestDispatcher.INCLUDE_PATH_INFO); + dispatcherAttributes.add(RequestDispatcher.INCLUDE_QUERY_STRING); + dispatcherAttributes.add(RequestDispatcher.INCLUDE_REQUEST_URI); + dispatcherAttributes.add(RequestDispatcher.INCLUDE_SERVLET_PATH); + } public static HttpServletRequestWrapperImpl findHttpRuntimeRequest( HttpServletRequest request) { @@ -157,7 +159,7 @@ public class HttpServletRequestWrapperImpl extends HttpServletRequestWrapper { String servletName = current.getServletName(); if (dispatcherType == DispatcherType.ERROR) { - if ((Arrays.binarySearch(dispatcherAttributes, attributeName) > -1) && + if (dispatcherAttributes.contains(attributeName) && !attributeName.startsWith("javax.servlet.error.")) { //$NON-NLS-1$ return null; @@ -210,7 +212,7 @@ public class HttpServletRequestWrapperImpl extends HttpServletRequestWrapper { return current.getServletPath(); } - if (Arrays.binarySearch(dispatcherAttributes, attributeName) > -1) { + if (dispatcherAttributes.contains(attributeName)) { return null; } } @@ -248,7 +250,7 @@ public class HttpServletRequestWrapperImpl extends HttpServletRequestWrapper { return original.getServletPath(); } - if (Arrays.binarySearch(dispatcherAttributes, attributeName) > -1) { + if (dispatcherAttributes.contains(attributeName)) { return null; } } |