From b92ebfa684857d988054b3b894a03742a60c896d Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Tue, 8 Oct 2019 13:54:34 +0300 Subject: Modernize equinox.http.servlet.tests * Remove useless type arguments * Remove not needed throws declarations * Add missing Override annotations. Change-Id: I407cb99f94bdc93175ceb713722cf06295617747 Signed-off-by: Alexander Kurtakov --- .../.settings/org.eclipse.jdt.core.prefs | 29 +- .../servlet/tests/tb/AbstractTestResource.java | 4 +- .../http/servlet/tests/tb/AbstractTestServlet.java | 2 +- .../tests/tb/AbstractWhiteboardTestFilter.java | 2 +- .../tests/tb/AbstractWhiteboardTestServlet.java | 1 + .../http/servlet/tests/tb1/TestErrorPage1.java | 16 +- .../http/servlet/tests/tb1/TestErrorPage2.java | 13 +- .../http/servlet/tests/tb1/TestErrorPage3.java | 16 +- .../http/servlet/tests/tb1/TestErrorPage4.java | 16 +- .../http/servlet/tests/tb1/TestFilter1.java | 5 +- .../http/servlet/tests/tb1/TestFilter10.java | 15 +- .../http/servlet/tests/tb1/TestFilter11.java | 17 +- .../http/servlet/tests/tb1/TestFilter12.java | 17 +- .../http/servlet/tests/tb1/TestFilter13.java | 13 +- .../http/servlet/tests/tb1/TestFilter14.java | 15 +- .../http/servlet/tests/tb1/TestFilter15.java | 17 +- .../http/servlet/tests/tb1/TestFilter16.java | 17 +- .../http/servlet/tests/tb1/TestFilter17.java | 19 +- .../http/servlet/tests/tb1/TestFilter18.java | 21 +- .../http/servlet/tests/tb1/TestFilter2.java | 5 +- .../http/servlet/tests/tb1/TestFilter3.java | 5 +- .../http/servlet/tests/tb1/TestFilter4.java | 7 +- .../http/servlet/tests/tb1/TestFilter5.java | 5 +- .../http/servlet/tests/tb1/TestFilter6.java | 5 +- .../http/servlet/tests/tb1/TestFilter7.java | 5 +- .../http/servlet/tests/tb1/TestFilter8.java | 7 +- .../http/servlet/tests/tb1/TestFilter9.java | 13 +- .../http/servlet/tests/tb1/TestResource3.java | 9 +- .../http/servlet/tests/tb1/TestResource4.java | 3 +- .../http/servlet/tests/tb1/TestResource5.java | 10 +- .../http/servlet/tests/tb1/TestServlet10.java | 5 +- .../http/servlet/tests/tb1/TestServlet11.java | 5 +- .../http/servlet/tests/tb1/TestServlet2.java | 4 +- .../http/servlet/tests/tb1/TestServlet4.java | 4 +- .../http/servlet/tests/tb1/TestServlet5.java | 6 +- .../http/servlet/tests/tb1/TestServlet6.java | 4 +- .../http/servlet/tests/tb1/TestServlet7.java | 4 +- .../http/servlet/tests/tb1/TestServlet9.java | 4 +- .../servlet/tests/tb1/TestServletContext1.java | 5 +- .../tests/tb1/TestServletContextHelper1.java | 8 + .../tests/tb1/TestServletContextHelper10.java | 15 +- .../http/servlet/tests/util/BaseFilter.java | 2 +- .../servlet/tests/util/CharResponseWrapper.java | 5 +- .../http/servlet/tests/wb/t1/WBServlet1.java | 4 +- .../http/servlet/tests/wb/t2/WBServlet2.java | 4 +- .../equinox/http/servlet/testbase/BaseTest.java | 14 +- .../http/servlet/tests/AuthenticationTest.java | 16 +- .../equinox/http/servlet/tests/Bug500783_Test.java | 7 +- .../tests/ContextHelperCustomizerTests.java | 22 +- .../http/servlet/tests/DispatchingTest.java | 206 +++++---- .../http/servlet/tests/PreprocessorTestCase.java | 2 +- .../equinox/http/servlet/tests/ServletTest.java | 466 ++++++++++----------- .../servlet/tests/TestHttpServiceAndErrorPage.java | 2 +- .../tests/TestHttpServiceAndNamedServlet.java | 2 +- .../equinox/http/servlet/tests/TestUpload.java | 7 +- .../equinox/http/servlet/tests/Test_140_11_3.java | 2 +- .../http/servlet/tests/Test_140_2_17to22.java | 6 +- .../http/servlet/tests/Test_140_2_26to27.java | 10 +- .../http/servlet/tests/Test_140_2_39to41.java | 6 +- .../tests/Test_140_2_6_getResourcePaths.java | 8 +- .../http/servlet/tests/Test_140_4_11to13.java | 5 +- .../http/servlet/tests/Test_140_4_14to15.java | 5 +- .../equinox/http/servlet/tests/Test_140_4_16.java | 5 +- .../http/servlet/tests/Test_140_4_17to22.java | 9 +- .../http/servlet/tests/Test_140_4_1_22to23.java | 8 +- .../http/servlet/tests/Test_140_4_26to31.java | 5 +- .../http/servlet/tests/Test_140_4_42to44.java | 6 +- .../equinox/http/servlet/tests/Test_140_4_9.java | 5 +- .../equinox/http/servlet/tests/Test_140_6_1.java | 4 +- .../tests/Test_140_6_20to21_commonProperties.java | 2 +- .../http/servlet/tests/Test_140_7_validation.java | 4 +- ...st_140_9_ServletContextDTO_custom_listener.java | 8 +- ...t_140_9_ServletContextDTO_default_listener.java | 6 +- ...EBOARD_CONTEXT_NAME_bindUsingContextSelect.java | 8 +- ...TP_WHITEBOARD_CONTEXT_NAME_tieGoesToOldest.java | 10 +- ...le_140_1_HTTP_WHITEBOARD_CONTEXT_PATH_type.java | 4 +- ..._4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED.java | 7 +- ...HITEBOARD_SERVLET_ASYNC_SUPPORTED_validate.java | 12 +- ...0_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_4xx.java | 13 +- ...TP_WHITEBOARD_SERVLET_ERROR_PAGE_exception.java | 8 +- ..._5_HTTP_WHITEBOARD_FILTER_DISPATCHER_error.java | 9 +- ..._HTTP_WHITEBOARD_FILTER_DISPATCHER_request.java | 6 +- ...table_140_5_HTTP_WHITEBOARD_FILTER_PATTERN.java | 4 +- ...t_table_140_5_HTTP_WHITEBOARD_FILTER_REGEX.java | 4 +- ..._140_6_HTTP_WHITEBOARD_RESOURCE_validation.java | 4 +- .../http/servlet/tests/bundle/BundleInstaller.java | 9 +- .../servlet/tests/util/AsyncOutputServlet.java | 3 +- .../http/servlet/tests/util/BaseAsyncServlet.java | 5 +- .../tests/util/BaseChangeSessionIdServlet.java | 3 +- .../http/servlet/tests/util/BaseHttpContext.java | 4 +- .../http/servlet/tests/util/BaseServlet.java | 1 + .../http/servlet/tests/util/BufferedServlet.java | 3 +- .../servlet/tests/util/DispatchResultServlet.java | 3 +- .../http/servlet/tests/util/EventHandler.java | 4 +- .../http/servlet/tests/util/MockFilter.java | 2 +- .../servlet/tests/util/ServletRequestAdvisor.java | 6 +- .../servlet/tests/util/TestServletPrototype.java | 15 +- .../http/servlet/tests/util/TestWBServlet.java | 9 +- 98 files changed, 645 insertions(+), 767 deletions(-) diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.http.servlet.tests/.settings/org.eclipse.jdt.core.prefs index 4ba3fcccc..ec2db86f3 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.http.servlet.tests/.settings/org.eclipse.jdt.core.prefs @@ -16,6 +16,7 @@ org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.APILeak=warning org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore @@ -25,7 +26,7 @@ org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -38,14 +39,14 @@ org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore @@ -53,19 +54,21 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore @@ -73,21 +76,27 @@ org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractTestResource.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractTestResource.java index 4bbe5d4b1..ec9a4f1a4 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractTestResource.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractTestResource.java @@ -14,7 +14,6 @@ package org.eclipse.equinox.http.servlet.tests.tb; -import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; @@ -35,6 +34,7 @@ public abstract class AbstractTestResource { private HttpService service; + @SuppressWarnings("unused") public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { HttpService service = getHttpService(); String alias = getAlias(); @@ -78,7 +78,7 @@ public abstract class AbstractTestResource { return clazz.getSimpleName(); } - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print(AbstractTestResource.STATUS_OK); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractTestServlet.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractTestServlet.java index 7dd78ff4c..5ebd206d7 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractTestServlet.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractTestServlet.java @@ -16,7 +16,6 @@ package org.eclipse.equinox.http.servlet.tests.tb; import java.io.IOException; import java.io.PrintWriter; - import java.util.Map; import javax.servlet.ServletException; @@ -92,6 +91,7 @@ public abstract class AbstractTestServlet extends HttpServlet { return clazz.getSimpleName(); } + @SuppressWarnings("unused") protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { writer.print(AbstractTestServlet.STATUS_OK); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractWhiteboardTestFilter.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractWhiteboardTestFilter.java index 842e99530..9056fa851 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractWhiteboardTestFilter.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractWhiteboardTestFilter.java @@ -62,7 +62,7 @@ public abstract class AbstractWhiteboardTestFilter implements Filter { } @Override - public void init(FilterConfig arg0) throws ServletException { + public void init(FilterConfig arg0) { // } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractWhiteboardTestServlet.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractWhiteboardTestServlet.java index d289251fb..8818d3b61 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractWhiteboardTestServlet.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb/AbstractWhiteboardTestServlet.java @@ -40,6 +40,7 @@ public class AbstractWhiteboardTestServlet extends HttpServlet { } } + @SuppressWarnings("unused") protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { writer.print(AbstractTestServlet.STATUS_OK); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage1.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage1.java index 281f72f9c..2d2fef7b8 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage1.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage1.java @@ -16,7 +16,6 @@ package org.eclipse.equinox.http.servlet.tests.tb1; import java.io.IOException; import java.io.PrintWriter; - import java.util.ArrayList; import java.util.Collection; import java.util.Dictionary; @@ -24,16 +23,13 @@ import java.util.Hashtable; import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; - import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /* @@ -42,14 +38,14 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestErrorPage1 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { - Dictionary servletProps = new Hashtable(); + public void activate(ComponentContext componentContext) { + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); - Dictionary errorProps = new Hashtable(); + Dictionary errorProps = new Hashtable<>(); errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E1"); errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, new String[] {"403", "404"}); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, errorServlet, errorProps)); @@ -64,7 +60,7 @@ public class TestErrorPage1 extends AbstractTestServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException ,IOException { + throws IOException { response.sendError(403); } @@ -75,7 +71,7 @@ public class TestErrorPage1 extends AbstractTestServlet { @Override protected void service( HttpServletRequest request, HttpServletResponse response) - throws ServletException ,IOException { + throws IOException { if (response.isCommitted()) { System.out.println("Problem?"); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage2.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage2.java index b523f8833..1d4acfd07 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage2.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage2.java @@ -33,7 +33,6 @@ import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /* @@ -42,14 +41,14 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestErrorPage2 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { - Dictionary servletProps = new Hashtable(); + public void activate(ComponentContext componentContext) { + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); - Dictionary errorProps = new Hashtable(); + Dictionary errorProps = new Hashtable<>(); errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E1"); errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, new String[] {MyException.class.getName()}); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, errorServlet, errorProps)); @@ -64,7 +63,7 @@ public class TestErrorPage2 extends AbstractTestServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException ,IOException { + throws ServletException { throw new MyException(); } @@ -76,7 +75,7 @@ public class TestErrorPage2 extends AbstractTestServlet { @Override protected void service( HttpServletRequest request, HttpServletResponse response) - throws ServletException ,IOException { + throws IOException { if (response.isCommitted()) { System.out.println("Problem?"); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage3.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage3.java index bac032a4f..f188469dc 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage3.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage3.java @@ -16,7 +16,6 @@ package org.eclipse.equinox.http.servlet.tests.tb1; import java.io.IOException; import java.io.PrintWriter; - import java.util.ArrayList; import java.util.Collection; import java.util.Dictionary; @@ -24,16 +23,13 @@ import java.util.Hashtable; import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; - import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /* @@ -42,14 +38,14 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestErrorPage3 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { - Dictionary servletProps = new Hashtable(); + public void activate(ComponentContext componentContext) { + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S3"); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); - Dictionary errorProps = new Hashtable(); + Dictionary errorProps = new Hashtable<>(); errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E3"); errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, "400"); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, errorServlet, errorProps)); @@ -64,7 +60,7 @@ public class TestErrorPage3 extends AbstractTestServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException ,IOException { + throws IOException { response.sendError(400); } @@ -75,7 +71,7 @@ public class TestErrorPage3 extends AbstractTestServlet { @Override protected void service( HttpServletRequest request, HttpServletResponse response) - throws ServletException ,IOException { + throws IOException { if (response.isCommitted()) { System.out.println("Problem?"); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage4.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage4.java index 85e2f932b..e721579c2 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage4.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestErrorPage4.java @@ -16,7 +16,6 @@ package org.eclipse.equinox.http.servlet.tests.tb1; import java.io.IOException; import java.io.PrintWriter; - import java.util.ArrayList; import java.util.Collection; import java.util.Dictionary; @@ -24,16 +23,13 @@ import java.util.Hashtable; import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; - import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /* @@ -42,14 +38,14 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestErrorPage4 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { - Dictionary servletProps = new Hashtable(); + public void activate(ComponentContext componentContext) { + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S4"); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); - Dictionary errorProps = new Hashtable(); + Dictionary errorProps = new Hashtable<>(); errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E4"); errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, "401"); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, errorServlet, errorProps)); @@ -64,7 +60,7 @@ public class TestErrorPage4 extends AbstractTestServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException ,IOException { + throws IOException { response.setStatus(401); @@ -77,7 +73,7 @@ public class TestErrorPage4 extends AbstractTestServlet { @Override protected void service( HttpServletRequest request, HttpServletResponse response) - throws ServletException ,IOException { + throws IOException { if (response.isCommitted()) { System.out.println("Problem?"); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter1.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter1.java index 1df6cbc9f..07fac76fe 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter1.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter1.java @@ -14,9 +14,7 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; - import java.util.Hashtable; import javax.servlet.Filter; @@ -26,7 +24,6 @@ import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.ExtendedHttpService; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; - import org.osgi.service.component.ComponentContext; import org.osgi.service.http.NamespaceException; @@ -52,7 +49,7 @@ public class TestFilter1 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter10.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter10.java index 72ba6f9e4..dd63c5b1b 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter10.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter10.java @@ -14,7 +14,6 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; @@ -23,14 +22,12 @@ import java.util.Hashtable; import javax.servlet.Filter; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /* @@ -39,19 +36,19 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestFilter10 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { - Dictionary servletProps = new Hashtable(); + public void activate(ComponentContext componentContext) { + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); - Dictionary filterProps = new Hashtable(); + Dictionary filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f1, filterProps)); - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F2"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f2, filterProps)); @@ -65,7 +62,7 @@ public class TestFilter10 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter11.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter11.java index 49a8d1dd5..0eeae9b11 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter11.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter11.java @@ -14,7 +14,6 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; @@ -23,14 +22,12 @@ import java.util.Hashtable; import javax.servlet.Filter; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /* @@ -39,26 +36,26 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestFilter11 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { + public void activate(ComponentContext componentContext) { - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); - Dictionary filterProps = new Hashtable(); + Dictionary filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f1, filterProps)); - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F2"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f2, filterProps)); - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F3"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f3, filterProps)); @@ -72,7 +69,7 @@ public class TestFilter11 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter12.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter12.java index a49ab7cb8..9dd448692 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter12.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter12.java @@ -14,7 +14,6 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; @@ -23,7 +22,6 @@ import java.util.Hashtable; import javax.servlet.Filter; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; @@ -31,7 +29,6 @@ import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; import org.osgi.framework.Constants; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /* @@ -40,25 +37,25 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestFilter12 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { + public void activate(ComponentContext componentContext) { - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); - Dictionary filterProps = new Hashtable(); + Dictionary filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f1, filterProps)); - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F2"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f2, filterProps)); - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F3"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, regexAlias()); filterProps.put(Constants.SERVICE_RANKING, 1); @@ -73,7 +70,7 @@ public class TestFilter12 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter13.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter13.java index cf890dc95..e8d90d98e 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter13.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter13.java @@ -14,7 +14,6 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; @@ -23,14 +22,12 @@ import java.util.Hashtable; import javax.servlet.Filter; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /* @@ -39,14 +36,14 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestFilter13 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { - Dictionary servletProps = new Hashtable(); + public void activate(ComponentContext componentContext) { + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, extensionAlias()); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); - Dictionary filterProps = new Hashtable(); + Dictionary filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, extensionAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f1, filterProps)); @@ -60,7 +57,7 @@ public class TestFilter13 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter14.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter14.java index 6db5f74e4..589b3b719 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter14.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter14.java @@ -14,7 +14,6 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; @@ -23,14 +22,12 @@ import java.util.Hashtable; import javax.servlet.Filter; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /* @@ -39,21 +36,21 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestFilter14 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { + public void activate(ComponentContext componentContext) { - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, extensionAlias()); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); - Dictionary filterProps = new Hashtable(); + Dictionary filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, extensionAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f1, filterProps)); - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F2"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, extensionAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f2, filterProps)); @@ -67,7 +64,7 @@ public class TestFilter14 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter15.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter15.java index dffefee9e..eae27193e 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter15.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter15.java @@ -14,7 +14,6 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; @@ -23,14 +22,12 @@ import java.util.Hashtable; import javax.servlet.Filter; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /* @@ -39,26 +36,26 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestFilter15 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { + public void activate(ComponentContext componentContext) { - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, extensionAlias()); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); - Dictionary filterProps = new Hashtable(); + Dictionary filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, extensionAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f1, filterProps)); - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F2"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, extensionAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f2, filterProps)); - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F3"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, extensionAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f3, filterProps)); @@ -72,7 +69,7 @@ public class TestFilter15 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter16.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter16.java index ebd704347..04adc7da9 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter16.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter16.java @@ -14,7 +14,6 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; @@ -23,7 +22,6 @@ import java.util.Hashtable; import javax.servlet.Filter; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; @@ -31,7 +29,6 @@ import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; import org.osgi.framework.Constants; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /* @@ -40,26 +37,26 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestFilter16 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { + public void activate(ComponentContext componentContext) { - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, extensionAlias()); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); - Dictionary filterProps = new Hashtable(); + Dictionary filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, extensionAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f1, filterProps)); - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F2"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, extensionAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f2, filterProps)); - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F3"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, extensionAlias()); filterProps.put(Constants.SERVICE_RANKING, 1); @@ -74,7 +71,7 @@ public class TestFilter16 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter17.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter17.java index 42fca281c..51bda130c 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter17.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter17.java @@ -14,7 +14,6 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; @@ -23,7 +22,6 @@ import java.util.Hashtable; import javax.servlet.Filter; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; @@ -31,7 +29,6 @@ import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; import org.osgi.framework.Constants; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /* @@ -40,12 +37,12 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestFilter17 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { + public void activate(ComponentContext componentContext) { - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "TestFilter17"); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/TestFilter17/foo/bar/baz"); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); @@ -53,25 +50,25 @@ public class TestFilter17 extends AbstractTestServlet { // Should order like: ebcdadcbe // b - Dictionary filterProps = new Hashtable(); + Dictionary filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/TestFilter17/foo/bar/*"); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f1, filterProps)); // c - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F2"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/TestFilter17/*"); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f2, filterProps)); // d - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F3"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/TestFilter17/foo/*"); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f3, filterProps)); // e - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F4"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_SERVLET, "TestFilter17"); filterProps.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE); @@ -86,7 +83,7 @@ public class TestFilter17 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter18.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter18.java index 9545e2fd6..e4e254646 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter18.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter18.java @@ -14,7 +14,6 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; @@ -23,7 +22,6 @@ import java.util.Hashtable; import javax.servlet.Filter; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; @@ -31,7 +29,6 @@ import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; import org.osgi.framework.Constants; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /* @@ -40,12 +37,12 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestFilter18 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { + public void activate(ComponentContext componentContext) { - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "TestFilter18"); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/TestFilter18/foo/bar/baz/*"); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); @@ -53,33 +50,33 @@ public class TestFilter18 extends AbstractTestServlet { // Should order like: dbcacbd // b - Dictionary filterProps = new Hashtable(); + Dictionary filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/TestFilter18/foo/bar/*"); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f1, filterProps)); // c - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F2"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_REGEX, "^/TestFilter18/.*$"); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f2, filterProps)); // d - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F3"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_REGEX, ".*18/foo/.*"); filterProps.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f3, filterProps)); // e - should fail to register - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F4"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_REGEX, "*"); filterProps.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f4, filterProps)); // f - filterProps = new Hashtable(); + filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F5"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_REGEX, ".*/baz/with/.*"); filterProps.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE); @@ -94,7 +91,7 @@ public class TestFilter18 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter2.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter2.java index d2771d247..2c8128cd9 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter2.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter2.java @@ -14,9 +14,7 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; - import java.util.Hashtable; import javax.servlet.Filter; @@ -26,7 +24,6 @@ import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.ExtendedHttpService; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; - import org.osgi.service.component.ComponentContext; import org.osgi.service.http.NamespaceException; @@ -54,7 +51,7 @@ public class TestFilter2 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter3.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter3.java index 499548bdb..bfb776c70 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter3.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter3.java @@ -14,9 +14,7 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; - import java.util.Hashtable; import javax.servlet.Filter; @@ -26,7 +24,6 @@ import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.ExtendedHttpService; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; - import org.osgi.service.component.ComponentContext; import org.osgi.service.http.NamespaceException; @@ -56,7 +53,7 @@ public class TestFilter3 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter4.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter4.java index 957a62804..f7f0008f7 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter4.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter4.java @@ -14,9 +14,7 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; - import java.util.Hashtable; import javax.servlet.Filter; @@ -26,7 +24,6 @@ import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.ExtendedHttpService; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; - import org.osgi.service.component.ComponentContext; import org.osgi.service.http.NamespaceException; @@ -43,7 +40,7 @@ public class TestFilter4 extends AbstractTestServlet { service.registerServlet(regexAlias(), this, null, null); service.registerFilter(regexAlias(), f1, new Hashtable(), null); service.registerFilter(regexAlias(), f2, new Hashtable(), null); - Hashtable hashtable = new Hashtable(); + Hashtable hashtable = new Hashtable<>(); hashtable.put("filter-priority", "1"); service.registerFilter(regexAlias(), f3, hashtable, null); } @@ -58,7 +55,7 @@ public class TestFilter4 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter5.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter5.java index 7dc921df8..a6ac399f5 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter5.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter5.java @@ -14,9 +14,7 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; - import java.util.Hashtable; import javax.servlet.Filter; @@ -26,7 +24,6 @@ import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.ExtendedHttpService; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; - import org.osgi.service.component.ComponentContext; import org.osgi.service.http.NamespaceException; @@ -52,7 +49,7 @@ public class TestFilter5 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter6.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter6.java index 5c90fe502..d8b930aef 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter6.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter6.java @@ -14,9 +14,7 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; - import java.util.Hashtable; import javax.servlet.Filter; @@ -26,7 +24,6 @@ import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.ExtendedHttpService; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; - import org.osgi.service.component.ComponentContext; import org.osgi.service.http.NamespaceException; @@ -54,7 +51,7 @@ public class TestFilter6 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter7.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter7.java index ab781873a..0680ca4fe 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter7.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter7.java @@ -14,9 +14,7 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; - import java.util.Hashtable; import javax.servlet.Filter; @@ -26,7 +24,6 @@ import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.ExtendedHttpService; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; - import org.osgi.service.component.ComponentContext; import org.osgi.service.http.NamespaceException; @@ -56,7 +53,7 @@ public class TestFilter7 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter8.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter8.java index bda2d2a9b..8e6dd5554 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter8.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter8.java @@ -14,9 +14,7 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; - import java.util.Hashtable; import javax.servlet.Filter; @@ -26,7 +24,6 @@ import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.ExtendedHttpService; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; - import org.osgi.service.component.ComponentContext; import org.osgi.service.http.NamespaceException; @@ -43,7 +40,7 @@ public class TestFilter8 extends AbstractTestServlet { service.registerServlet(extensionAlias(), this, null, null); service.registerFilter(extensionAlias(), f1, new Hashtable(), null); service.registerFilter(extensionAlias(), f2, new Hashtable(), null); - Hashtable hashtable = new Hashtable(); + Hashtable hashtable = new Hashtable<>(); hashtable.put("filter-priority", "1"); service.registerFilter(extensionAlias(), f3, hashtable, null); } @@ -58,7 +55,7 @@ public class TestFilter8 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter9.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter9.java index eba6630e9..685bfb88d 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter9.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestFilter9.java @@ -14,7 +14,6 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; @@ -23,14 +22,12 @@ import java.util.Hashtable; import javax.servlet.Filter; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /* @@ -40,14 +37,14 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; public class TestFilter9 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { - Dictionary servletProps = new Hashtable(); + public void activate(ComponentContext componentContext) { + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); - Dictionary filterProps = new Hashtable(); + Dictionary filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f1, filterProps)); @@ -62,7 +59,7 @@ public class TestFilter9 extends AbstractTestServlet { @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource3.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource3.java index ca7244a25..3b96d1d38 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource3.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource3.java @@ -19,22 +19,19 @@ import java.util.Collection; import java.util.Dictionary; import java.util.Hashtable; -import javax.servlet.ServletException; - import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestResource; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /** * @author Raymond Augé */ public class TestResource3 extends AbstractTestResource { - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { - Dictionary resourceProps = new Hashtable(); + public void activate(ComponentContext componentContext) { + Dictionary resourceProps = new Hashtable<>(); resourceProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PATTERN, regexAlias()); resourceProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PREFIX, getName()); registrations.add(componentContext.getBundleContext().registerService(TestResource3.class, this, resourceProps)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource4.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource4.java index bbb231531..f91c960cf 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource4.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource4.java @@ -22,7 +22,6 @@ import javax.servlet.ServletException; import org.eclipse.equinox.http.servlet.ExtendedHttpService; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestResource; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; - import org.osgi.service.component.ComponentContext; import org.osgi.service.http.NamespaceException; @@ -37,7 +36,7 @@ public class TestResource4 extends AbstractTestResource { service.registerResources(regexAlias(), getName() , null); service.registerFilter(regexAlias(), f1, new Hashtable(), null); service.registerFilter(regexAlias(), f2, new Hashtable(), null); - Hashtable hashtable = new Hashtable(); + Hashtable hashtable = new Hashtable<>(); hashtable.put("filter-priority", "1"); service.registerFilter(regexAlias(), f3, hashtable, null); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource5.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource5.java index cf0f07ccb..18b93e1a1 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource5.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestResource5.java @@ -20,14 +20,12 @@ import java.util.Dictionary; import java.util.Hashtable; import javax.servlet.Filter; -import javax.servlet.ServletException; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestResource; import org.eclipse.equinox.http.servlet.tests.util.BaseFilter; import org.osgi.framework.Constants; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; /** @@ -35,15 +33,15 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestResource5 extends AbstractTestResource { - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { - Dictionary resourceProps = new Hashtable(); + public void activate(ComponentContext componentContext) { + Dictionary resourceProps = new Hashtable<>(); resourceProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PATTERN, regexAlias()); resourceProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PREFIX, getName()); registrations.add(componentContext.getBundleContext().registerService(TestResource5.class, this, resourceProps)); - Dictionary filterProps = new Hashtable(); + Dictionary filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, regexAlias()); registrations.add(componentContext.getBundleContext().registerService(Filter.class, f1, filterProps)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet10.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet10.java index e35a4c975..dbec8d0c0 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet10.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet10.java @@ -20,7 +20,6 @@ import java.io.OutputStream; import java.io.PrintWriter; import javax.servlet.ServletContext; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -34,7 +33,7 @@ public class TestServlet10 extends AbstractTestServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { ServletContext servletContext = getServletContext(); @@ -57,7 +56,7 @@ public class TestServlet10 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { // } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet11.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet11.java index 979e749f3..eb8724925 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet11.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet11.java @@ -20,7 +20,6 @@ import java.io.OutputStream; import java.io.PrintWriter; import javax.servlet.ServletContext; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -34,7 +33,7 @@ public class TestServlet11 extends AbstractTestServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { ServletContext servletContext = getServletContext(); @@ -59,7 +58,7 @@ public class TestServlet11 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { // } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet2.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet2.java index 641421cce..15a576781 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet2.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet2.java @@ -13,11 +13,9 @@ *******************************************************************************/ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletContext; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; @@ -36,7 +34,7 @@ public class TestServlet2 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { int version = getEffectiveMajorVersion(); writer.print(version); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet4.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet4.java index f7dce6d54..29a02e9a3 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet4.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet4.java @@ -14,11 +14,9 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletContext; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; @@ -30,7 +28,7 @@ public class TestServlet4 extends AbstractTestServlet { private static final long serialVersionUID = 1L; @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { ServletContext servletContext = getServletContext(); writer.print(servletContext.getContextPath()); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet5.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet5.java index 0e0e487fc..7f46b9a53 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet5.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet5.java @@ -14,16 +14,12 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; - import java.util.Map; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; - import org.osgi.framework.Constants; import org.osgi.service.http.runtime.HttpServiceRuntime; @@ -35,7 +31,7 @@ public class TestServlet5 extends AbstractTestServlet { private Map properties; @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print(properties.get(Constants.SERVICE_DESCRIPTION)); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet6.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet6.java index 8e8cb902a..5467a6788 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet6.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet6.java @@ -14,10 +14,8 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; @@ -34,7 +32,7 @@ public class TestServlet6 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet7.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet7.java index 1b3d9d605..593b41035 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet7.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet7.java @@ -14,10 +14,8 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; @@ -34,7 +32,7 @@ public class TestServlet7 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet9.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet9.java index 5e8b7b7e5..a07d44ebe 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet9.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServlet9.java @@ -56,14 +56,14 @@ public class TestServlet9 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { // } class DispatchTo extends AbstractTestServlet { private static final long serialVersionUID = 1L; @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print(TestServlet9.this.getProperties().get(Constants.SERVICE_DESCRIPTION)); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServletContext1.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServletContext1.java index ed9ff1b4f..a44afdc29 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServletContext1.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServletContext1.java @@ -14,13 +14,10 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; - import java.util.Set; import javax.servlet.ServletContext; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; @@ -33,7 +30,7 @@ public class TestServletContext1 extends AbstractTestServlet { private static final long serialVersionUID = 1L; @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { ServletContext servletContext = request.getServletContext(); Set resourcePaths = servletContext.getResourcePaths("/org/eclipse/equinox/http/servlet/tests/tb1"); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServletContextHelper1.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServletContextHelper1.java index 8fb8f908c..3b3a635fc 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServletContextHelper1.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServletContextHelper1.java @@ -16,34 +16,42 @@ public class TestServletContextHelper1 extends ServletContextHelper { delegate = new ServletContextHelper(componentContext.getBundleContext().getBundle()) {}; } + @Override public int hashCode() { return delegate.hashCode(); } + @Override public boolean equals(Object obj) { return delegate.equals(obj); } + @Override public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException { return delegate.handleSecurity(request, response); } + @Override public URL getResource(String name) { return delegate.getResource(name); } + @Override public String toString() { return delegate.toString(); } + @Override public String getMimeType(String name) { return delegate.getMimeType(name); } + @Override public Set getResourcePaths(String path) { return delegate.getResourcePaths(path); } + @Override public String getRealPath(String path) { return delegate.getRealPath(path); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServletContextHelper10.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServletContextHelper10.java index 6f5ce51e3..d82d550bc 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServletContextHelper10.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/tb1/TestServletContextHelper10.java @@ -14,7 +14,6 @@ package org.eclipse.equinox.http.servlet.tests.tb1; -import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; @@ -23,7 +22,6 @@ import java.util.Hashtable; import javax.servlet.Filter; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractTestServlet; @@ -32,7 +30,6 @@ import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; -import org.osgi.service.http.NamespaceException; import org.osgi.service.http.context.ServletContextHelper; import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; @@ -42,15 +39,15 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; */ public class TestServletContextHelper10 extends AbstractTestServlet { private static final long serialVersionUID = 1L; - private final Collection> registrations = new ArrayList>(); + private final Collection> registrations = new ArrayList<>(); @Override - public void activate(ComponentContext componentContext) throws ServletException, NamespaceException { - Dictionary servletProps = new Hashtable(); + public void activate(ComponentContext componentContext) { + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, regexAlias()); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(componentContext.getBundleContext().registerService(Servlet.class, this, servletProps)); - Dictionary filterProps = new Hashtable(); + Dictionary filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, regexAlias()); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); @@ -60,7 +57,7 @@ public class TestServletContextHelper10 extends AbstractTestServlet { Bundle bundle = bundleContext.getBundle(); ServletContextHelper servletContextHelper = new ServletContextHelper(bundle) {}; - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(componentContext.getBundleContext().registerService(ServletContextHelper.class, servletContextHelper, contextProps)); @@ -74,7 +71,7 @@ public class TestServletContextHelper10 extends AbstractTestServlet { } @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/util/BaseFilter.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/util/BaseFilter.java index f51b6346a..9bc0ec062 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/util/BaseFilter.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/util/BaseFilter.java @@ -64,7 +64,7 @@ public class BaseFilter implements Filter { } @Override - public void init(FilterConfig arg0) throws ServletException { + public void init(FilterConfig arg0) { // } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/util/CharResponseWrapper.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/util/CharResponseWrapper.java index b3cd36bb9..8fa4ad297 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/util/CharResponseWrapper.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/util/CharResponseWrapper.java @@ -15,7 +15,6 @@ package org.eclipse.equinox.http.servlet.tests.util; import java.io.CharArrayWriter; -import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletOutputStream; @@ -35,11 +34,11 @@ public class CharResponseWrapper extends HttpServletResponseWrapper { } @Override - public ServletOutputStream getOutputStream() throws IOException { + public ServletOutputStream getOutputStream() { return new ServletOutputStream() { @Override - public void write(int b) throws IOException { + public void write(int b) { output.write(b); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/wb/t1/WBServlet1.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/wb/t1/WBServlet1.java index ba245c05d..6b104a322 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/wb/t1/WBServlet1.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/wb/t1/WBServlet1.java @@ -14,10 +14,8 @@ package org.eclipse.equinox.http.servlet.tests.wb.t1; -import java.io.IOException; import java.io.PrintWriter; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractWhiteboardTestServlet; @@ -29,7 +27,7 @@ public class WBServlet1 extends AbstractWhiteboardTestServlet { private static final long serialVersionUID = 1L; @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/wb/t2/WBServlet2.java b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/wb/t2/WBServlet2.java index 950c7998f..44cfd3f01 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/wb/t2/WBServlet2.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/bundles_src/tb1/org/eclipse/equinox/http/servlet/tests/wb/t2/WBServlet2.java @@ -14,10 +14,8 @@ package org.eclipse.equinox.http.servlet.tests.wb.t2; -import java.io.IOException; import java.io.PrintWriter; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.eclipse.equinox.http.servlet.tests.tb.AbstractWhiteboardTestServlet; @@ -29,7 +27,7 @@ public class WBServlet2 extends AbstractWhiteboardTestServlet { private static final long serialVersionUID = 1L; @Override - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { writer.print('a'); } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/testbase/BaseTest.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/testbase/BaseTest.java index 2fb59501d..0f9318345 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/testbase/BaseTest.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/testbase/BaseTest.java @@ -228,7 +228,7 @@ public class BaseTest { return Arrays.asList((String[])property); } else if (Collection.class.isInstance(property)) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (@SuppressWarnings("rawtypes") Iterator i = ((Collection)property).iterator(); i.hasNext();) { @@ -246,6 +246,7 @@ public class BaseTest { return installer.installBundle(bundle); } + @SuppressWarnings("unused") protected void startBundles() throws BundleException { } @@ -295,6 +296,7 @@ public class BaseTest { requestAdvisor = new ServletRequestAdvisor(port, contextPath, ksPath, ksPassword); } + @SuppressWarnings("unused") protected void stopBundles() throws BundleException { } @@ -635,7 +637,7 @@ public class BaseTest { protected BundleInstaller installer; protected BundleAdvisor advisor; protected ServletRequestAdvisor requestAdvisor; - protected final Collection> registrations = new ArrayList>(); + protected final Collection> registrations = new ArrayList<>(); protected ServiceTracker> runtimeTracker; protected static class TestFilter implements Filter { @@ -644,7 +646,7 @@ public class BaseTest { public TestFilter() {} @Override - public void init(FilterConfig filterConfig) throws ServletException { + public void init(FilterConfig filterConfig) { // nothing } @@ -677,7 +679,7 @@ public class BaseTest { static class TestServletContextHelper extends ServletContextHelper { public TestServletContextHelper(Bundle bundle) { super(bundle); - }}; + }} public TestServletContextHelperFactory() {} @@ -740,7 +742,7 @@ public class BaseTest { @Override protected void service( HttpServletRequest request, HttpServletResponse response) - throws ServletException ,IOException { + throws IOException { if (response.isCommitted()) { System.out.println("Problem?"); @@ -756,6 +758,6 @@ public class BaseTest { writer.print(errorCode + " : " + status + " : ERROR : " + requestURI); } - }; + } } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/AuthenticationTest.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/AuthenticationTest.java index 2c1dd6261..8edb555d6 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/AuthenticationTest.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/AuthenticationTest.java @@ -82,11 +82,11 @@ public class AuthenticationTest extends BaseTest { private static final String REC_PAR = "rec"; - private void setup(final List callStack) throws Exception { + private void setup(final List callStack) { final BundleContext context = getBundleContext(); // setup context 1 - final Dictionary ctx1Props = new Hashtable(); + final Dictionary ctx1Props = new Hashtable<>(); ctx1Props.put(HTTP_WHITEBOARD_CONTEXT_NAME, "context1"); ctx1Props.put(HTTP_WHITEBOARD_CONTEXT_PATH, "/context1"); registrations.add(context.registerService( @@ -94,8 +94,7 @@ public class AuthenticationTest extends BaseTest { new ServletContextHelper() { @Override - public boolean handleSecurity(final HttpServletRequest request, final HttpServletResponse response) - throws IOException { + public boolean handleSecurity(final HttpServletRequest request, final HttpServletResponse response) { if (request.getParameter(AUTH_PAR) != null) { callStack.add("handle1"); @@ -114,7 +113,7 @@ public class AuthenticationTest extends BaseTest { ); // setup context 2 - final Dictionary ctx2Props = new Hashtable(); + final Dictionary ctx2Props = new Hashtable<>(); ctx2Props.put(HTTP_WHITEBOARD_CONTEXT_NAME, "context2"); ctx2Props.put(HTTP_WHITEBOARD_CONTEXT_PATH, "/context2"); registrations.add(context.registerService( @@ -122,8 +121,7 @@ public class AuthenticationTest extends BaseTest { new ServletContextHelper() { @Override - public boolean handleSecurity(final HttpServletRequest request, final HttpServletResponse response) - throws IOException { + public boolean handleSecurity(final HttpServletRequest request, final HttpServletResponse response) { callStack.add("handle2"); return true; @@ -168,9 +166,9 @@ public class AuthenticationTest extends BaseTest { response.setStatus(200); } - }; + } - final Dictionary servletProps = new Hashtable(); + final Dictionary servletProps = new Hashtable<>(); servletProps.put(HTTP_WHITEBOARD_SERVLET_PATTERN, new String[] {"/servlet"}); servletProps.put(HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HTTP_WHITEBOARD_CONTEXT_NAME + "=context1)"); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Bug500783_Test.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Bug500783_Test.java index 871f1a631..34e16f4a3 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Bug500783_Test.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Bug500783_Test.java @@ -30,7 +30,6 @@ import java.util.Map; import java.util.Map.Entry; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -49,7 +48,7 @@ public class Bug500783_Test extends BaseTest { HttpServlet myServlet = new HttpServlet() { @Override - protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { int contentLength = req.getContentLength(); InputStream in = req.getInputStream(); @@ -89,11 +88,11 @@ public class Bug500783_Test extends BaseTest { } }; - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/MyServlet"); registrations.add(context.registerService(Servlet.class, myServlet, properties)); - Map> map = new HashMap>(); + Map> map = new HashMap<>(); map.put("method", Arrays.asList("POST")); map.put("x-www-form-urlencoded", Arrays.asList("fielda=foo&fieldb=bar")); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ContextHelperCustomizerTests.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ContextHelperCustomizerTests.java index 4413e6e2c..ba0479224 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ContextHelperCustomizerTests.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ContextHelperCustomizerTests.java @@ -50,31 +50,31 @@ public class ContextHelperCustomizerTests extends BaseTest { private BundleContext context; @Before - public void begin() throws Exception { + public void begin() { httpServiceReference = getBundleContext().getServiceReference(HttpService.class); context = httpServiceReference.getBundle().getBundleContext(); httpService = context.getService(httpServiceReference); } @After - public void end() throws Exception { + public void end() { context.ungetService(httpServiceReference); } @Test - public void testCreateDefaultHttpContextCreatesNewServletContextHelper() throws Exception { + public void testCreateDefaultHttpContextCreatesNewServletContextHelper() { HttpContext context1 = httpService.createDefaultHttpContext(); HttpContext context2 = httpService.createDefaultHttpContext(); Assert.assertNotEquals(context1, context2); } @Test - public void testServletContextHelpersNotHiddenWhenRegisteredUsingConsumingContext() throws Exception { + public void testServletContextHelpersNotHiddenWhenRegisteredUsingConsumingContext() { ServiceRegistration helperReg = null; ServiceRegistration findHookReg = null; try { - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "context1"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/context1"); //register a ServletContextHelper using the consuming bundle context "org.eclipse.equinox.http.servlet" @@ -104,9 +104,9 @@ public class ContextHelperCustomizerTests extends BaseTest { }; findHookReg = context.registerService(FindHook.class, findHook, null); - AtomicReference sc1 = new AtomicReference(); + AtomicReference sc1 = new AtomicReference<>(); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(osgi.http.whiteboard.context.name=context1)"); context.registerService(ServletContextListener.class, new MockSCL(sc1), properties); @@ -132,7 +132,7 @@ public class ContextHelperCustomizerTests extends BaseTest { ServiceRegistration findHookReg = null; try { - Dictionary helperProps = new Hashtable(); + Dictionary helperProps = new Hashtable<>(); helperProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "testContext" + testName.getMethodName()); helperProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/helperContext"); helperProps.put(TEST_PATH_CUSTOMIZER_NAME, testName.getMethodName()); @@ -168,7 +168,7 @@ public class ContextHelperCustomizerTests extends BaseTest { //Register a servlet service with a matching context helper BaseServlet baseServlet = new BaseServlet("content"); - Dictionary serviceProps = new Hashtable(); + Dictionary serviceProps = new Hashtable<>(); serviceProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/servlet"); serviceProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=" + "testContext" + testName.getMethodName() + ")"); servlet = context.registerService(Servlet.class, baseServlet, serviceProps); @@ -199,7 +199,7 @@ public class ContextHelperCustomizerTests extends BaseTest { ServiceRegistration findHookReg = null; try { - Dictionary helperProps = new Hashtable(); + Dictionary helperProps = new Hashtable<>(); helperProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "testContext" + testName.getMethodName()); helperProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/helperContext"); helperProps.put(TEST_PATH_CUSTOMIZER_NAME, testName.getMethodName()); @@ -235,7 +235,7 @@ public class ContextHelperCustomizerTests extends BaseTest { //Register a servlet service with a matching context helper BaseServlet baseServlet = new BaseServlet("content"); - Dictionary serviceProps = new Hashtable(); + Dictionary serviceProps = new Hashtable<>(); serviceProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/servlet"); //Filter property serviceProps.put("servlet.init." + TEST_PATH_CUSTOMIZER_NAME, testName.getMethodName()); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/DispatchingTest.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/DispatchingTest.java index 5f8afd896..63cb6fa47 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/DispatchingTest.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/DispatchingTest.java @@ -37,8 +37,8 @@ import javax.servlet.FilterChain; import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; import javax.servlet.ServletContext; -import javax.servlet.ServletOutputStream; import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.Cookie; @@ -66,7 +66,7 @@ public class DispatchingTest extends BaseTest { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { StringWriter writer = new StringWriter(); @@ -81,12 +81,12 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); @@ -108,17 +108,17 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); @@ -156,22 +156,22 @@ public class DispatchingTest extends BaseTest { }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_DISPATCHER, new String[] {DispatcherType.REQUEST.toString()}); @@ -212,22 +212,22 @@ public class DispatchingTest extends BaseTest { }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_DISPATCHER, new String[] {DispatcherType.FORWARD.toString(),DispatcherType.REQUEST.toString()}); @@ -262,22 +262,22 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "c1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/c1"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet2, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s3/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); @@ -319,27 +319,27 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "c1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/c1"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet2, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s3/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet3, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s4/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); @@ -372,7 +372,7 @@ public class DispatchingTest extends BaseTest { @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { PrintWriter writer = resp.getWriter(); writer.write(String.valueOf(req.getQueryString())); @@ -385,18 +385,18 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "c1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/c1"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "s1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); registrations.add(getBundleContext().registerService(Servlet.class, sA, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "s2"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); @@ -425,18 +425,18 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "c1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/c1"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "s1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); registrations.add(getBundleContext().registerService(Servlet.class, sA, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "s2"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); @@ -468,7 +468,7 @@ public class DispatchingTest extends BaseTest { @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { PrintWriter writer = resp.getWriter(); writer.write(req.getQueryString()); @@ -481,12 +481,12 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S13A"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Servlet13A/*"); registrations.add(getBundleContext().registerService(Servlet.class, sA, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S13B"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Servlet13B/*"); registrations.add(getBundleContext().registerService(Servlet.class, sB, props)); @@ -508,17 +508,17 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); @@ -556,22 +556,22 @@ public class DispatchingTest extends BaseTest { }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_DISPATCHER, new String[] {DispatcherType.REQUEST.toString()}); @@ -612,22 +612,22 @@ public class DispatchingTest extends BaseTest { }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_DISPATCHER, new String[] {DispatcherType.FORWARD.toString(),DispatcherType.REQUEST.toString()}); @@ -662,7 +662,7 @@ public class DispatchingTest extends BaseTest { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { response.getWriter().print("s8target"); } @@ -691,17 +691,17 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); @@ -739,22 +739,22 @@ public class DispatchingTest extends BaseTest { }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_DISPATCHER, new String[] {DispatcherType.REQUEST.toString()}); @@ -795,22 +795,22 @@ public class DispatchingTest extends BaseTest { }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_DISPATCHER, new String[] {DispatcherType.INCLUDE.toString(), DispatcherType.REQUEST.toString()}); @@ -845,22 +845,22 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "c1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/c1"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet2, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s3/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); @@ -902,27 +902,27 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "c1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/c1"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet2, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s3/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet3, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s4/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); @@ -955,7 +955,7 @@ public class DispatchingTest extends BaseTest { @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { PrintWriter writer = resp.getWriter(); writer.write(req.getQueryString()); @@ -968,18 +968,18 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "c1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/c1"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "s1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); registrations.add(getBundleContext().registerService(Servlet.class, sA, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "s2"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); @@ -1008,18 +1008,18 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "c1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/c1"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "s1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); registrations.add(getBundleContext().registerService(Servlet.class, sA, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "s2"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=c1)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); @@ -1051,7 +1051,7 @@ public class DispatchingTest extends BaseTest { @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { PrintWriter writer = resp.getWriter(); writer.write(req.getQueryString()); @@ -1064,12 +1064,12 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S13A"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Servlet13A/*"); registrations.add(getBundleContext().registerService(Servlet.class, sA, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S13B"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Servlet13B/*"); registrations.add(getBundleContext().registerService(Servlet.class, sB, props)); @@ -1091,17 +1091,17 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); @@ -1139,22 +1139,22 @@ public class DispatchingTest extends BaseTest { }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_DISPATCHER, new String[] {DispatcherType.REQUEST.toString()}); @@ -1195,22 +1195,22 @@ public class DispatchingTest extends BaseTest { }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper() {}, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(Servlet.class, new DispatchResultServlet(), props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_DISPATCHER, new String[] {DispatcherType.INCLUDE.toString(), DispatcherType.REQUEST.toString()}); @@ -1231,9 +1231,9 @@ public class DispatchingTest extends BaseTest { @Override protected void doGet( final HttpServletRequest req, final HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { - final AtomicReference results = new AtomicReference(); + final AtomicReference results = new AtomicReference<>(); Thread thread = new Thread() { @@ -1267,7 +1267,7 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "Bug479115"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Bug479115/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); @@ -1309,8 +1309,7 @@ public class DispatchingTest extends BaseTest { private static final long serialVersionUID = 1L; @Override - protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) { response.addCookie(new Cookie("foo","baz")); response.addDateHeader("X-date", date2); @@ -1324,11 +1323,11 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet2, props)); @@ -1384,8 +1383,7 @@ public class DispatchingTest extends BaseTest { private static final long serialVersionUID = 1L; @Override - protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) { response.addCookie(new Cookie("foo","baz")); response.addDateHeader("X-date", date2); @@ -1399,11 +1397,11 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s2/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet2, props)); @@ -1460,7 +1458,7 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); @@ -1536,7 +1534,7 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); @@ -1587,7 +1585,7 @@ public class DispatchingTest extends BaseTest { @Override protected void doGet( final HttpServletRequest req, final HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { String requestURI = req.getRequestURI(); @@ -1598,7 +1596,7 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "Bug497510"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Bug497510/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); @@ -1616,7 +1614,7 @@ public class DispatchingTest extends BaseTest { @Override protected void doGet( final HttpServletRequest req, final HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { String requestURI = req.getRequestURI(); @@ -1627,7 +1625,7 @@ public class DispatchingTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "Bug 497510"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Bug 497510/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/PreprocessorTestCase.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/PreprocessorTestCase.java index 22a3683a5..e1642c8e9 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/PreprocessorTestCase.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/PreprocessorTestCase.java @@ -45,7 +45,7 @@ import org.osgi.service.http.whiteboard.Preprocessor; public class PreprocessorTestCase extends BaseTest { @Test - public void testPreprocessorInitParameters() throws Exception { + public void testPreprocessorInitParameters() { Dictionary properties = new Hashtable<>(); properties .put(HttpWhiteboardConstants.HTTP_WHITEBOARD_PREPROCESSOR_INIT_PARAM_PREFIX diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java index e820cef83..1a8a322eb 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java @@ -232,16 +232,16 @@ public class ServletTest extends BaseTest { @Test public void test_ErrorPage5() throws Exception { BundleContext bundleContext = getBundleContext(); - Dictionary serviceProps = new Hashtable(); + Dictionary serviceProps = new Hashtable<>(); serviceProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/prototype/*"); TestServletPrototype testDriver = new TestServletPrototype(bundleContext); registrations.add(bundleContext.registerService(Servlet.class, testDriver, serviceProps)); - Dictionary errorProps = new Hashtable(); + Dictionary errorProps = new Hashtable<>(); errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E5.4xx"); errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, "4xx"); registrations.add(getBundleContext().registerService(Servlet.class, new ErrorServlet("4xx"), errorProps)); - errorProps = new Hashtable(); + errorProps = new Hashtable<>(); errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E5.5xx"); errorProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, "5xx"); registrations.add(getBundleContext().registerService(Servlet.class, new ErrorServlet("5xx"), errorProps)); @@ -269,7 +269,7 @@ public class ServletTest extends BaseTest { @Override protected void service( HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { response.getWriter().write("Hello!"); response.setStatus(444); @@ -277,11 +277,11 @@ public class ServletTest extends BaseTest { }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E6"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/TestErrorPage6/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E6.error"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, "444"); registrations.add(getBundleContext().registerService(Servlet.class, new ErrorServlet("444"), props)); @@ -309,7 +309,7 @@ public class ServletTest extends BaseTest { @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { resp.setStatus(status); @@ -325,11 +325,11 @@ public class ServletTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E7"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/TestErrorPage7/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E7.error"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, String.valueOf(status)); registrations.add(getBundleContext().registerService(Servlet.class, new ErrorServlet(String.valueOf(status)), props)); @@ -350,18 +350,17 @@ public class ServletTest extends BaseTest { @Override protected void doGet( - HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + HttpServletRequest req, HttpServletResponse resp) { throw new RuntimeException(); } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E8"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/TestErrorPage8/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E8.error"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, RuntimeException.class.getName()); registrations.add(getBundleContext().registerService(Servlet.class, new ErrorServlet("500"), props)); @@ -383,17 +382,17 @@ public class ServletTest extends BaseTest { @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { throw new IOException(); } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E9"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/TestErrorPage9/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E9.error"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, IOException.class.getName()); registrations.add(getBundleContext().registerService(Servlet.class, new ErrorServlet("500"), props)); @@ -408,14 +407,14 @@ public class ServletTest extends BaseTest { } @Test - public void test_ErrorPage10() throws Exception { + public void test_ErrorPage10() { Servlet servlet = new HttpServlet() { private static final long serialVersionUID = 1L; @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { resp.getWriter().write("some output"); resp.flushBuffer(); @@ -424,7 +423,7 @@ public class ServletTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E10"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/TestErrorPage10/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); @@ -442,21 +441,21 @@ public class ServletTest extends BaseTest { } @Test - public void test_ErrorPage11() throws Exception { + public void test_ErrorPage11() { Servlet servlet = new HttpServlet() { private static final long serialVersionUID = 1L; @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { resp.sendError(403); resp.getOutputStream().flush(); } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "E10"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/TestErrorPage11/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); @@ -769,17 +768,17 @@ public class ServletTest extends BaseTest { TestFilter testFilter2 = new TestFilter(); Servlet testServlet = new BaseServlet(expected); - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/hello"); registrations.add(getBundleContext().registerService(Filter.class, testFilter1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F2"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/hello/*"); registrations.add(getBundleContext().registerService(Filter.class, testFilter2, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/hello/*"); registrations.add(getBundleContext().registerService(Servlet.class, testServlet, props)); @@ -797,8 +796,8 @@ public class ServletTest extends BaseTest { } public void basicFilterTest22( String servlet1Pattern, String servlet2Pattern, String filterPattern, String expected, String[] dispatchers ) throws Exception { - final AtomicReference httpServletRequestWrapper = new AtomicReference(); - final AtomicReference httpServletResponseWrapper = new AtomicReference(); + final AtomicReference httpServletRequestWrapper = new AtomicReference<>(); + final AtomicReference httpServletResponseWrapper = new AtomicReference<>(); Servlet servlet1 = new BaseServlet() { private static final long serialVersionUID = 1L; @@ -849,15 +848,15 @@ public class ServletTest extends BaseTest { }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, servlet1Pattern); registrations.add(getBundleContext().registerService(Servlet.class, servlet1, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, servlet2Pattern); registrations.add(getBundleContext().registerService(Servlet.class, servlet2, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "F22"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_DISPATCHER, dispatchers); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, filterPattern); @@ -974,9 +973,9 @@ public class ServletTest extends BaseTest { TestFilter testFilter2 = new TestFilter(); Servlet testServlet = new BaseServlet(expected); - registrations.add(getBundleContext().registerService(Filter.class, testFilter1, new Hashtable(Collections.singletonMap(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/*")))); - registrations.add(getBundleContext().registerService(Filter.class, testFilter2, new Hashtable(Collections.singletonMap(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/hello/*")))); - registrations.add(getBundleContext().registerService(Servlet.class, testServlet, new Hashtable(Collections.singletonMap(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/")))); + registrations.add(getBundleContext().registerService(Filter.class, testFilter1, new Hashtable<>(Collections.singletonMap(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/*")))); + registrations.add(getBundleContext().registerService(Filter.class, testFilter2, new Hashtable<>(Collections.singletonMap(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/hello/*")))); + registrations.add(getBundleContext().registerService(Servlet.class, testServlet, new Hashtable<>(Collections.singletonMap(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/")))); String actual = requestAdvisor.request("hello_test/request"); Assert.assertEquals(expected, actual); @@ -999,9 +998,9 @@ public class ServletTest extends BaseTest { TestFilter testFilter1 = new TestFilter(); Servlet testServlet = new BaseServlet(expected); - ServiceRegistration filterReg = getBundleContext().registerService(Filter.class, testFilter1, new Hashtable(Collections.singletonMap(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/hello/*"))); + ServiceRegistration filterReg = getBundleContext().registerService(Filter.class, testFilter1, new Hashtable<>(Collections.singletonMap(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/hello/*"))); try { - registrations.add(getBundleContext().registerService(Servlet.class, testServlet, new Hashtable(Collections.singletonMap(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/hello/*")))); + registrations.add(getBundleContext().registerService(Servlet.class, testServlet, new Hashtable<>(Collections.singletonMap(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/hello/*")))); String actual = requestAdvisor.request("hello/request"); Assert.assertEquals(expected, actual); @@ -1261,7 +1260,7 @@ public class ServletTest extends BaseTest { private static final long serialVersionUID = 1L; @Override - public void init(ServletConfig config) throws ServletException { + public void init(ServletConfig config) { throw new IllegalStateException("Init error."); } @@ -1281,13 +1280,12 @@ public class ServletTest extends BaseTest { Filter initError = new Filter() { @Override - public void init(FilterConfig filterConfig) throws ServletException { + public void init(FilterConfig filterConfig) { throw new IllegalStateException("Init error."); } @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, - ServletException { + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) { // nothing } @@ -1316,8 +1314,7 @@ public class ServletTest extends BaseTest { } @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, - ServletException { + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) { // nothing } @@ -1353,11 +1350,11 @@ public class ServletTest extends BaseTest { }; - Hashtable props = new Hashtable(); + Hashtable props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, servletName); registrations.add(getBundleContext().registerService(Servlet.class, namedServlet, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s"); registrations.add(getBundleContext().registerService(Servlet.class, targetServlet, props)); @@ -1372,7 +1369,7 @@ public class ServletTest extends BaseTest { Filter tcclFilter = new Filter() { @Override - public void init(FilterConfig filterConfig) throws ServletException { + public void init(FilterConfig filterConfig) { filterTCCL.add(Thread.currentThread().getContextClassLoader().getClass().getName()); } @@ -1405,8 +1402,7 @@ public class ServletTest extends BaseTest { private static final long serialVersionUID = 1L; @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { servletTCCL.add(Thread.currentThread().getContextClassLoader().getClass().getName()); response.getWriter().print(Thread.currentThread().getContextClassLoader().getClass().getName()); } @@ -1477,8 +1473,7 @@ public class ServletTest extends BaseTest { private static final long serialVersionUID = 1L; @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpSession session = request.getSession(); if (session.getAttribute("test.attribute") == null) { session.setAttribute("test.attribute", bindingListener); @@ -1492,14 +1487,14 @@ public class ServletTest extends BaseTest { }; ServiceRegistration servletReg = null; ServiceRegistration sessionListenerReg = null; - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/sessions"); String actual = null; CookieHandler previous = CookieHandler.getDefault(); CookieHandler.setDefault(new CookieManager( null, CookiePolicy.ACCEPT_ALL ) ); try { servletReg = getBundleContext().registerService(Servlet.class, sessionServlet, servletProps); - Dictionary listenerProps = new Hashtable(); + Dictionary listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); sessionListenerReg = getBundleContext().registerService(HttpSessionListener.class, sessionListener, listenerProps); @@ -1551,14 +1546,13 @@ public class ServletTest extends BaseTest { @Test public void test_Sessions02() { - final AtomicReference sessionReference = new AtomicReference(); + final AtomicReference sessionReference = new AtomicReference<>(); HttpServlet sessionServlet = new HttpServlet() { private static final long serialVersionUID = 1L; @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpSession session = request.getSession(); sessionReference.set(session); if (session.getAttribute("test.attribute") == null) { @@ -1571,7 +1565,7 @@ public class ServletTest extends BaseTest { } }; ServiceRegistration servletReg = null; - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/sessions"); String actual = null; CookieHandler previous = CookieHandler.getDefault(); @@ -1634,7 +1628,7 @@ public class ServletTest extends BaseTest { }; final AtomicBoolean sessionCreated = new AtomicBoolean(false); final AtomicBoolean sessionDestroyed = new AtomicBoolean(false); - final AtomicReference sessionId = new AtomicReference(); + final AtomicReference sessionId = new AtomicReference<>(); HttpSessionListener sessionListener = new HttpSessionListener() { @Override @@ -1651,8 +1645,7 @@ public class ServletTest extends BaseTest { private static final long serialVersionUID = 1L; @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpSession session = request.getSession(); if (session.getAttribute("test.attribute") == null) { session.setAttribute("test.attribute", bindingListener); @@ -1667,14 +1660,14 @@ public class ServletTest extends BaseTest { }; ServiceRegistration servletReg = null; ServiceRegistration sessionListenerReg = null; - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/sessions"); String actual = null; CookieHandler previous = CookieHandler.getDefault(); CookieHandler.setDefault(new CookieManager( null, CookiePolicy.ACCEPT_ALL ) ); try { servletReg = getBundleContext().registerService(Servlet.class, sessionServlet, servletProps); - Dictionary listenerProps = new Hashtable(); + Dictionary listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); sessionListenerReg = getBundleContext().registerService(HttpSessionListener.class, sessionListener, listenerProps); @@ -1769,8 +1762,7 @@ public class ServletTest extends BaseTest { private static final long serialVersionUID = 1L; @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpSession session = request.getSession(); if (session.getAttribute("test.attribute") == null) { session.setAttribute("test.attribute", bindingListener); @@ -1784,13 +1776,13 @@ public class ServletTest extends BaseTest { }; ServiceRegistration servletReg = null; ServiceRegistration sessionListenerReg = null; - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/sessions"); String actual = null; try { servletReg = getBundleContext().registerService(Servlet.class, sessionServlet, servletProps); - Dictionary listenerProps = new Hashtable(); + Dictionary listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); sessionListenerReg = getBundleContext().registerService(HttpSessionListener.class, sessionListener, listenerProps); @@ -1842,7 +1834,7 @@ public class ServletTest extends BaseTest { } @Test - public void test_Sessions05_Bug541607_MemoryLeak() throws Exception { + public void test_Sessions05_Bug541607_MemoryLeak() { final List sessionIds = new CopyOnWriteArrayList<>(); HttpSessionListener sessionListener = new HttpSessionListener() { @@ -1860,8 +1852,7 @@ public class ServletTest extends BaseTest { private static final long serialVersionUID = 1L; @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpSession session = request.getSession(); response.getWriter().print("created " + session.getId()); } @@ -1869,12 +1860,12 @@ public class ServletTest extends BaseTest { }; ServiceRegistration servletReg = null; ServiceRegistration sessionListenerReg = null; - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/sessions"); try { servletReg = getBundleContext().registerService(Servlet.class, sessionServlet, servletProps); - Dictionary listenerProps = new Hashtable(); + Dictionary listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); sessionListenerReg = getBundleContext().registerService(HttpSessionListener.class, sessionListener, listenerProps); @@ -2000,7 +1991,7 @@ public class ServletTest extends BaseTest { return null; } }; - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "foo"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/foo"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, customSCH, contextProps)); @@ -2032,7 +2023,7 @@ public class ServletTest extends BaseTest { return null; } }; - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "foo"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/foo"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, customSCH, contextProps)); @@ -2069,7 +2060,7 @@ public class ServletTest extends BaseTest { return userAgent.contains("Foo") && contentType.startsWith("video/"); } }; - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "foo"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/foo"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, customSCH, contextProps)); @@ -2261,7 +2252,7 @@ public class ServletTest extends BaseTest { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { response.getWriter().write('a'); } @@ -2273,7 +2264,7 @@ public class ServletTest extends BaseTest { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { response.getWriter().write('b'); } @@ -2298,7 +2289,7 @@ public class ServletTest extends BaseTest { @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { PrintWriter writer = resp.getWriter(); writer.write(req.getQueryString()); @@ -2309,7 +2300,7 @@ public class ServletTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S13"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Servlet13/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); @@ -2326,7 +2317,7 @@ public class ServletTest extends BaseTest { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { response.getWriter().write('a'); } @@ -2338,7 +2329,7 @@ public class ServletTest extends BaseTest { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { response.getWriter().write('b'); } @@ -2393,13 +2384,13 @@ public class ServletTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S16"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Servlet16/*"); props.put("equinox.http.multipartSupported", Boolean.TRUE); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); - Map> map = new HashMap>(); + Map> map = new HashMap<>(); map.put("file", Arrays.asList(getClass().getResource("resource1.txt"))); @@ -2422,12 +2413,12 @@ public class ServletTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S16"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Servlet16/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); - Map> map = new HashMap>(); + Map> map = new HashMap<>(); map.put("file", Arrays.asList(getClass().getResource("resource1.txt"))); @@ -2467,14 +2458,14 @@ public class ServletTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S16"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Servlet16/*"); props.put("equinox.http.multipartSupported", Boolean.TRUE); props.put("equinox.http.whiteboard.servlet.multipart.location", "file-upload-test"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); - Map> map = new HashMap>(); + Map> map = new HashMap<>(); map.put("file", Arrays.asList(getClass().getResource("resource1.txt"))); @@ -2515,7 +2506,7 @@ public class ServletTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S16"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Servlet16/*"); props.put("equinox.http.multipartSupported", Boolean.TRUE); @@ -2523,7 +2514,7 @@ public class ServletTest extends BaseTest { props.put("equinox.http.whiteboard.servlet.multipart.fileSizeThreshold", 10); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); - Map> map = new HashMap>(); + Map> map = new HashMap<>(); map.put("file", Arrays.asList(getClass().getResource("resource1.txt"))); @@ -2546,7 +2537,7 @@ public class ServletTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S16"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Servlet16/*"); props.put("equinox.http.multipartSupported", Boolean.TRUE); @@ -2555,7 +2546,7 @@ public class ServletTest extends BaseTest { props.put("equinox.http.whiteboard.servlet.multipart.maxFileSize", 24L); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); - Map> map = new HashMap>(); + Map> map = new HashMap<>(); map.put("file", Arrays.asList(getClass().getResource("resource1.txt"))); @@ -2577,7 +2568,7 @@ public class ServletTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S16"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Servlet16/*"); props.put("equinox.http.multipartSupported", Boolean.TRUE); @@ -2586,7 +2577,7 @@ public class ServletTest extends BaseTest { props.put("equinox.http.whiteboard.servlet.multipart.maxRequestSize", 26L); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); - Map> map = new HashMap>(); + Map> map = new HashMap<>(); map.put("file", Arrays.asList(getClass().getResource("resource1.txt"))); @@ -2647,7 +2638,7 @@ public class ServletTest extends BaseTest { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { // get a resource that is imported URL url = request.getServletContext().getResource("org/osgi/service/http/HttpService.class"); response.getWriter().write(url == null ? "null" : url.getProtocol()); @@ -2672,7 +2663,7 @@ public class ServletTest extends BaseTest { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) - throws IOException, ServletException { + throws IOException { boolean isMultipart = ServletFileUpload.isMultipartContent(req); Assert.assertTrue(isMultipart); @@ -2710,12 +2701,12 @@ public class ServletTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S16"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Servlet16/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); - Map> map = new HashMap>(); + Map> map = new HashMap<>(); map.put("file", Arrays.asList(getClass().getResource("blue.png"))); @@ -2732,7 +2723,7 @@ public class ServletTest extends BaseTest { @Override protected void service(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { PrintWriter writer = resp.getWriter(); @@ -2740,12 +2731,12 @@ public class ServletTest extends BaseTest { } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S16"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/Servlet16/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); - Map> map = new HashMap>(); + Map> map = new HashMap<>(); Map> result = requestAdvisor.request("Servlet16/NEEO-a5056097%2Fdevice%2Fapt-neeo_io%3Avirtual%3A6jzOoAtL%2FTemperature_GF_Living%2Fnone%2F1%2Fdirectory%2Factor/default", map); @@ -2796,15 +2787,14 @@ public class ServletTest extends BaseTest { @Override protected void service( - HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + HttpServletRequest request, HttpServletResponse response) { getServletContext().setAttribute("name", null); } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/S1/*"); registrations.add(getBundleContext().registerService(Servlet.class, servlet, props)); @@ -2818,17 +2808,17 @@ public class ServletTest extends BaseTest { @Test public void testServletContextUnsupportedOperations() { - final AtomicReference contextHolder = new AtomicReference(); + final AtomicReference contextHolder = new AtomicReference<>(); Servlet unsupportedServlet = new HttpServlet() { private static final long serialVersionUID = 1L; @Override - public void init(ServletConfig config) throws ServletException { + public void init(ServletConfig config) { contextHolder.set(config.getServletContext()); } }; ServiceRegistration servletReg = null; - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/sessions"); try { servletReg = getBundleContext().registerService(Servlet.class, unsupportedServlet, servletProps); @@ -2864,7 +2854,7 @@ public class ServletTest extends BaseTest { } static private List getUnsupportedMethods() { - List methods = new ArrayList(); + List methods = new ArrayList<>(); Class contextClass = ServletContext.class; for(Method m : contextClass.getMethods()) { String name = m.getName(); @@ -2876,32 +2866,32 @@ public class ServletTest extends BaseTest { } @Test - public void test_ServletContextHelper1() throws Exception { + public void test_ServletContextHelper1() { BundleContext bundleContext = getBundleContext(); Bundle bundle = bundleContext.getBundle(); ServletContextHelper servletContextHelper = new ServletContextHelper(bundle){}; - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelper, contextProps)); servletContextHelper = new ServletContextHelper(bundle){}; - contextProps = new Hashtable(); + contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "test.sch.one"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelper, contextProps)); servletContextHelper = new ServletContextHelper(bundle){}; - contextProps = new Hashtable(); + contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/test-sch2"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelper, contextProps)); servletContextHelper = new ServletContextHelper(bundle){}; - contextProps = new Hashtable(); + contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "Test SCH 3!"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/test-sch3"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelper, contextProps)); servletContextHelper = new ServletContextHelper(bundle){}; - contextProps = new Hashtable(); + contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "test.sch.four"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "test$sch$4"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelper, contextProps)); @@ -2932,14 +2922,14 @@ public class ServletTest extends BaseTest { ServletContextHelper servletContextHelper = new ServletContextHelper(bundle){}; Servlet s1 = new BaseServlet("a"); - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelper, contextProps)); - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1"); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); @@ -2965,14 +2955,14 @@ public class ServletTest extends BaseTest { ServletContextHelper servletContextHelper = new ServletContextHelper(bundle){}; Servlet s1 = new BaseServlet("b"); - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelper, contextProps)); - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1"); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); @@ -3001,19 +2991,19 @@ public class ServletTest extends BaseTest { Servlet s1 = new BaseServlet(expected1); Servlet s2 = new BaseServlet(expected2); - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelper, contextProps)); - Dictionary servletProps1 = new Hashtable(); + Dictionary servletProps1 = new Hashtable<>(); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s"); registrations.add(bundleContext.registerService(Servlet.class, s1, servletProps1)); - Dictionary servletProps2 = new Hashtable(); + Dictionary servletProps2 = new Hashtable<>(); servletProps2.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); servletProps2.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s"); servletProps2.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); @@ -3045,7 +3035,7 @@ public class ServletTest extends BaseTest { Servlet s1 = new BaseServlet(expected1); - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { // register a hook that hides the helper from the registering bundle registrations.add(bundleContext.registerService(FindHook.class, new FindHook() { @@ -3059,12 +3049,12 @@ public class ServletTest extends BaseTest { } }, null)); - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelper, contextProps)); - Dictionary servletProps2 = new Hashtable(); + Dictionary servletProps2 = new Hashtable<>(); servletProps2.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); servletProps2.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s"); servletProps2.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); @@ -3135,7 +3125,7 @@ public class ServletTest extends BaseTest { @Override protected void service( HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { StringBuilder builder = new StringBuilder(); builder.append(request.getServletContext().getInitParameter("a")).append(','); @@ -3145,9 +3135,9 @@ public class ServletTest extends BaseTest { } }; - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_INIT_PARAM_PREFIX + "a", "a"); @@ -3155,7 +3145,7 @@ public class ServletTest extends BaseTest { contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_INIT_PARAM_PREFIX + "c", Integer.valueOf(1)); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelper, contextProps)); - Dictionary servletProps1 = new Hashtable(); + Dictionary servletProps1 = new Hashtable<>(); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); @@ -3190,7 +3180,7 @@ public class ServletTest extends BaseTest { Filter f1 = new Filter() { @Override - public void init(FilterConfig filterConfig) throws ServletException { + public void init(FilterConfig filterConfig) { } @Override @@ -3210,25 +3200,25 @@ public class ServletTest extends BaseTest { Servlet s1 = new HttpServlet() { private static final long serialVersionUID = 1L; @Override - public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { + public void service(ServletRequest req, ServletResponse res) throws IOException { res.getWriter().print(req.getAttribute(testName.getMethodName() + ".fromFilter")); } }; - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelper, contextProps)); - Dictionary filterProps = new Hashtable(); + Dictionary filterProps = new Hashtable<>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/*"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(bundleContext.registerService(Filter.class, f1, filterProps)); - Dictionary servletProps = new Hashtable(); + Dictionary servletProps = new Hashtable<>(); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s1"); servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); @@ -3253,25 +3243,25 @@ public class ServletTest extends BaseTest { ServletContextHelper servletContextHelperA = new ServletContextHelper(bundle){}; ServletContextHelper servletContextHelperB = new ServletContextHelper(bundle){}; - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - final AtomicReference fileA = new AtomicReference(); + final AtomicReference fileA = new AtomicReference<>(); Servlet servletA = new HttpServlet() { private static final long serialVersionUID = 1L; @Override protected void service(HttpServletRequest req, HttpServletResponse resp) - throws IOException, ServletException { + throws IOException { fileA.set((File)getServletContext().getAttribute(ServletContext.TEMPDIR)); new File(fileA.get(), "test").createNewFile(); } }; - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelperA, contextProps)); - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "SA"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/SA"); @@ -3281,7 +3271,7 @@ public class ServletTest extends BaseTest { Assert.assertNotNull(fileA.get()); Assert.assertTrue(new File(fileA.get(), "test").exists()); - contextProps = new Hashtable(); + contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "b"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/b"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelperB, contextProps)); @@ -3311,9 +3301,9 @@ public class ServletTest extends BaseTest { ServletContextHelper servletContextHelperA = new ServletContextHelper(bundle){}; - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - final AtomicReference path = new AtomicReference(); + final AtomicReference path = new AtomicReference<>(); Servlet servletA = new HttpServlet() { private static final long serialVersionUID = 1L; @@ -3327,22 +3317,21 @@ public class ServletTest extends BaseTest { Servlet servletB = new HttpServlet() { private static final long serialVersionUID = 1L; @Override - protected void service(HttpServletRequest req, HttpServletResponse resp) - throws IOException, ServletException { + protected void service(HttpServletRequest req, HttpServletResponse resp) { path.set((String)req.getAttribute(RequestDispatcher.INCLUDE_CONTEXT_PATH)); } }; - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelperA, contextProps)); - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "SA"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/SA"); registrations.add(getBundleContext().registerService(Servlet.class, servletA, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "SB"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/SB"); @@ -3381,9 +3370,9 @@ public class ServletTest extends BaseTest { ServletContextHelper servletContextHelperA = new ServletContextHelper(bundle){}; - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - final AtomicReference path = new AtomicReference(); + final AtomicReference path = new AtomicReference<>(); Servlet servletA = new HttpServlet() { private static final long serialVersionUID = 1L; @@ -3397,22 +3386,21 @@ public class ServletTest extends BaseTest { Servlet servletB = new HttpServlet() { private static final long serialVersionUID = 1L; @Override - protected void service(HttpServletRequest req, HttpServletResponse resp) - throws IOException, ServletException { + protected void service(HttpServletRequest req, HttpServletResponse resp) { path.set((String)req.getAttribute(RequestDispatcher.FORWARD_CONTEXT_PATH)); } }; - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelperA, contextProps)); - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "SA"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/SA"); registrations.add(getBundleContext().registerService(Servlet.class, servletA, props)); - props = new Hashtable(); + props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "SB"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/SB"); @@ -3446,24 +3434,23 @@ public class ServletTest extends BaseTest { startJetty(); } - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - final AtomicReference getRequestURI = new AtomicReference(); + final AtomicReference getRequestURI = new AtomicReference<>(); Servlet servletA = new HttpServlet() { private static final long serialVersionUID = 1L; @Override - protected void service(HttpServletRequest req, HttpServletResponse resp) - throws IOException, ServletException { + protected void service(HttpServletRequest req, HttpServletResponse resp) { getRequestURI.set(req.getRequestURI()); } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "SA"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, new String[] {"/*", "/"}); registrations.add(getBundleContext().registerService(Servlet.class, servletA, props)); - props = new Hashtable(); + props = new Hashtable<>(); requestAdvisor.request("a/b/c/"); @@ -3501,26 +3488,25 @@ public class ServletTest extends BaseTest { startJetty(); } - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - final AtomicReference getRequestURI = new AtomicReference(); + final AtomicReference getRequestURI = new AtomicReference<>(); Servlet servletA = new HttpServlet() { private static final long serialVersionUID = 1L; @Override - protected void service(HttpServletRequest req, HttpServletResponse resp) - throws IOException, ServletException { + protected void service(HttpServletRequest req, HttpServletResponse resp) { HttpSession session = req.getSession(); session.setAttribute("test", req.getParameter("p1")); getRequestURI.set(resp.encodeURL(req.getRequestURI())); } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "SA"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/*"); registrations.add(getBundleContext().registerService(Servlet.class, servletA, props)); - props = new Hashtable(); + props = new Hashtable<>(); requestAdvisor.request("a/b/c/?p1=v1"); // get the session @@ -3554,24 +3540,23 @@ public class ServletTest extends BaseTest { @Test public void test_getRequestURI_trailingSlash3() throws Exception { - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - final AtomicReference getRequestURI = new AtomicReference(); + final AtomicReference getRequestURI = new AtomicReference<>(); Servlet servletA = new HttpServlet() { private static final long serialVersionUID = 1L; @Override - protected void service(HttpServletRequest req, HttpServletResponse resp) - throws IOException, ServletException { + protected void service(HttpServletRequest req, HttpServletResponse resp) { getRequestURI.set(req.getRequestURI()); } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "SA"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, new String[] {"/*", "/"}); registrations.add(getBundleContext().registerService(Servlet.class, servletA, props)); - props = new Hashtable(); + props = new Hashtable<>(); requestAdvisor.request("a/b/c/"); Assert.assertEquals("/a/b/c/", getRequestURI.get()); @@ -3593,26 +3578,25 @@ public class ServletTest extends BaseTest { @Test public void test_getRequestURI_trailingSlash4() throws Exception { - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - final AtomicReference getRequestURI = new AtomicReference(); + final AtomicReference getRequestURI = new AtomicReference<>(); Servlet servletA = new HttpServlet() { private static final long serialVersionUID = 1L; @Override - protected void service(HttpServletRequest req, HttpServletResponse resp) - throws IOException, ServletException { + protected void service(HttpServletRequest req, HttpServletResponse resp) { HttpSession session = req.getSession(); session.setAttribute("test", req.getParameter("p1")); getRequestURI.set(resp.encodeURL(req.getRequestURI())); } }; - Dictionary props = new Hashtable(); + Dictionary props = new Hashtable<>(); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "SA"); props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/*"); registrations.add(getBundleContext().registerService(Servlet.class, servletA, props)); - props = new Hashtable(); + props = new Hashtable<>(); requestAdvisor.request("a/b/c/?p1=v1"); // get the session @@ -3638,11 +3622,11 @@ public class ServletTest extends BaseTest { } @Test - public void test_Listener1() throws Exception { + public void test_Listener1() { BaseServletContextListener scl1 = new BaseServletContextListener(); - Dictionary listenerProps = new Hashtable(); + Dictionary listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); ServiceRegistration registration = getBundleContext().registerService(ServletContextListener.class, scl1, listenerProps); registration.unregister(); @@ -3653,21 +3637,21 @@ public class ServletTest extends BaseTest { } @Test - public void test_Listener2() throws Exception { + public void test_Listener2() { BundleContext bundleContext = getBundleContext(); Bundle bundle = bundleContext.getBundle(); ServletContextHelper servletContextHelper = new ServletContextHelper(bundle){}; - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelper, contextProps)); BaseServletContextListener scl1 = new BaseServletContextListener(); - Dictionary listenerProps = new Hashtable(); + Dictionary listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); ServiceRegistration registration = getBundleContext().registerService(ServletContextListener.class, scl1, listenerProps); @@ -3684,20 +3668,20 @@ public class ServletTest extends BaseTest { } @Test - public void test_Listener3() throws Exception { + public void test_Listener3() { BundleContext bundleContext = getBundleContext(); Bundle bundle = bundleContext.getBundle(); ServletContextHelper servletContextHelper = new ServletContextHelper(bundle){}; BaseServletContextListener scl1 = new BaseServletContextListener(); - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(bundleContext.registerService(ServletContextHelper.class, servletContextHelper, contextProps)); - Dictionary listenerProps = new Hashtable(); + Dictionary listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); registrations.add(bundleContext.registerService(ServletContextListener.class, scl1, listenerProps)); @@ -3719,13 +3703,13 @@ public class ServletTest extends BaseTest { new BaseServletContextAttributeListener(); Servlet s1 = new BaseServlet("a"); - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary listenerProps = new Hashtable(); + Dictionary listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); registrations.add(getBundleContext().registerService(ServletContextAttributeListener.class, scal1, listenerProps)); - Dictionary servletProps1 = new Hashtable(); + Dictionary servletProps1 = new Hashtable<>(); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s"); registrations.add(getBundleContext().registerService(Servlet.class, s1, servletProps1)); @@ -3763,13 +3747,13 @@ public class ServletTest extends BaseTest { Servlet s1 = new BaseServlet("a"); - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary listenerProps = new Hashtable(); + Dictionary listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); registrations.add(getBundleContext().registerService(ServletRequestListener.class, srl1, listenerProps)); - Dictionary servletProps1 = new Hashtable(); + Dictionary servletProps1 = new Hashtable<>(); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s"); registrations.add(getBundleContext().registerService(Servlet.class, s1, servletProps1)); @@ -3793,13 +3777,13 @@ public class ServletTest extends BaseTest { Servlet s1 = new BaseServlet("a"); - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary listenerProps = new Hashtable(); + Dictionary listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); registrations.add(getBundleContext().registerService(ServletRequestAttributeListener.class, sral1, listenerProps)); - Dictionary servletProps1 = new Hashtable(); + Dictionary servletProps1 = new Hashtable<>(); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s"); registrations.add(getBundleContext().registerService(Servlet.class, s1, servletProps1)); @@ -3825,13 +3809,13 @@ public class ServletTest extends BaseTest { Servlet s1 = new BaseServlet("test_Listener7"); - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary listenerProps = new Hashtable(); + Dictionary listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); registrations.add(getBundleContext().registerService(HttpSessionAttributeListener.class, hsal1, listenerProps)); - Dictionary servletProps1 = new Hashtable(); + Dictionary servletProps1 = new Hashtable<>(); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s"); registrations.add(getBundleContext().registerService(Servlet.class, s1, servletProps1)); @@ -3857,7 +3841,7 @@ public class ServletTest extends BaseTest { } } - Map> requestHeaders = new HashMap>(); + Map> requestHeaders = new HashMap<>(); requestHeaders.put("Cookie", Arrays.asList(sessionId)); requestAdvisor.request("s", requestHeaders); @@ -3885,13 +3869,13 @@ public class ServletTest extends BaseTest { Servlet s1 = new BaseChangeSessionIdServlet("test_Listener8"); - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary listenerProps = new Hashtable(); + Dictionary listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); registrations.add(getBundleContext().registerService(HttpSessionIdListener.class, hsil1, listenerProps)); - Dictionary servletProps1 = new Hashtable(); + Dictionary servletProps1 = new Hashtable<>(); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S8"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s"); registrations.add(getBundleContext().registerService(Servlet.class, s1, servletProps1)); @@ -3928,7 +3912,7 @@ public class ServletTest extends BaseTest { @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { PrintWriter writer = resp.getWriter(); writer.write("S9 included"); @@ -3937,13 +3921,13 @@ public class ServletTest extends BaseTest { BaseServletRequestListener srl1 = new BaseServletRequestListener(); - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary listenerProps = new Hashtable(); + Dictionary listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); registrations.add(getBundleContext().registerService(ServletRequestListener.class, srl1, listenerProps)); - Dictionary servletProps1 = new Hashtable(); + Dictionary servletProps1 = new Hashtable<>(); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S9A"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s9A"); registrations.add(getBundleContext().registerService(Servlet.class, sA, servletProps1)); @@ -3966,25 +3950,25 @@ public class ServletTest extends BaseTest { } @Test - public void test_Listener10() throws Exception { + public void test_Listener10() { BaseServletContextListener scl1 = new BaseServletContextListener(); BaseServletContextListener scl2 = new BaseServletContextListener(); BaseServletContextListener scl3 = new BaseServletContextListener(); - Dictionary listenerProps = new Hashtable(); + Dictionary listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); registrations.add(getBundleContext().registerService(ServletContextListener.class, scl1, listenerProps)); - listenerProps = new Hashtable(); + listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); registrations.add(getBundleContext().registerService(ServletContextListener.class, scl2, listenerProps)); - Dictionary contextProps = new Hashtable(); + Dictionary contextProps = new Hashtable<>(); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); contextProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(getBundleContext().registerService(ServletContextHelper.class, new ServletContextHelper(){}, contextProps)); - listenerProps = new Hashtable(); + listenerProps = new Hashtable<>(); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); listenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=a)"); registrations.add(getBundleContext().registerService(ServletContextListener.class, scl3, listenerProps)); @@ -4019,7 +4003,7 @@ public class ServletTest extends BaseTest { public void test_Listener11() throws Exception { final AtomicInteger listenerBalance = new AtomicInteger(0); - final AtomicReference sessionReference = new AtomicReference(); + final AtomicReference sessionReference = new AtomicReference<>(); ServletContextListener scl = new ServletContextListener() { @@ -4051,7 +4035,7 @@ public class ServletTest extends BaseTest { @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { HttpSession session = req.getSession(); sessionReference.set(session); @@ -4062,17 +4046,17 @@ public class ServletTest extends BaseTest { } }; - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary scListenerProps = new Hashtable(); + Dictionary scListenerProps = new Hashtable<>(); scListenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); registrations.add(getBundleContext().registerService(ServletContextListener.class, scl, scListenerProps)); - Dictionary sListenerProps = new Hashtable(); + Dictionary sListenerProps = new Hashtable<>(); sListenerProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); registrations.add(getBundleContext().registerService(HttpSessionListener.class, sl, sListenerProps)); - Dictionary servletProps1 = new Hashtable(); + Dictionary servletProps1 = new Hashtable<>(); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S11"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s11"); registrations.add(getBundleContext().registerService(Servlet.class, sA, servletProps1)); @@ -4099,9 +4083,9 @@ public class ServletTest extends BaseTest { public void test_Async1() throws Exception { Servlet s1 = new BaseAsyncServlet("test_Listener8"); - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary servletProps1 = new Hashtable(); + Dictionary servletProps1 = new Hashtable<>(); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S1"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED, true); @@ -4121,9 +4105,9 @@ public class ServletTest extends BaseTest { @Test public void test_AsyncOutput1() throws Exception { Servlet s1 = new AsyncOutputServlet(); - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary servletProps1 = new Hashtable(); + Dictionary servletProps1 = new Hashtable<>(); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "AsyncOutputServlet"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/asyncOutput"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED, true); @@ -4173,9 +4157,9 @@ public class ServletTest extends BaseTest { @Test public void test_BufferedOutput() throws Exception { - Collection> registrations = new ArrayList>(); + Collection> registrations = new ArrayList<>(); try { - Dictionary servletProps1 = new Hashtable(); + Dictionary servletProps1 = new Hashtable<>(); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "S9"); servletProps1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/s9"); registrations.add(getBundleContext().registerService(Servlet.class, new BufferedServlet(), servletProps1)); @@ -4196,14 +4180,14 @@ public class ServletTest extends BaseTest { @Test public void testWBServletChangeInitParams() throws Exception{ BundleContext bundleContext = getBundleContext(); - Dictionary serviceProps = new Hashtable(); + Dictionary serviceProps = new Hashtable<>(); serviceProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/prototype/*"); TestServletPrototype testDriver = new TestServletPrototype(bundleContext); registrations.add(bundleContext.registerService(Servlet.class, testDriver, serviceProps)); String actual; - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TEST_PROTOTYPE_NAME, testName.getMethodName()); params.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, '/' + testName.getMethodName()); params.put(STATUS_PARAM, testName.getMethodName()); @@ -4222,14 +4206,14 @@ public class ServletTest extends BaseTest { @Test public void testWBServletChangePattern() throws Exception{ BundleContext bundleContext = getBundleContext(); - Dictionary serviceProps = new Hashtable(); + Dictionary serviceProps = new Hashtable<>(); serviceProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/prototype/*"); TestServletPrototype testDriver = new TestServletPrototype(bundleContext); registrations.add(bundleContext.registerService(Servlet.class, testDriver, serviceProps)); String actual; - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TEST_PROTOTYPE_NAME, testName.getMethodName()); params.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, '/' + testName.getMethodName()); params.put(STATUS_PARAM, testName.getMethodName()); @@ -4248,7 +4232,7 @@ public class ServletTest extends BaseTest { @Test public void testWBServletChangeRanking() throws Exception{ BundleContext bundleContext = getBundleContext(); - Dictionary serviceProps = new Hashtable(); + Dictionary serviceProps = new Hashtable<>(); serviceProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/prototype/*"); TestServletPrototype testDriver = new TestServletPrototype(bundleContext); registrations.add(bundleContext.registerService(Servlet.class, testDriver, serviceProps)); @@ -4256,7 +4240,7 @@ public class ServletTest extends BaseTest { String actual; // Configure two servlets with the second one registered ranking higher - Map params1 = new HashMap(); + Map params1 = new HashMap<>(); params1.put(TEST_PROTOTYPE_NAME, testName.getMethodName() + 1); params1.put(Constants.SERVICE_RANKING, "1"); params1.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, '/' + testName.getMethodName()); @@ -4264,7 +4248,7 @@ public class ServletTest extends BaseTest { actual = doRequest(CONFIGURE, params1); Assert.assertEquals(testName.getMethodName() + 1, actual); - Map params2 = new HashMap(); + Map params2 = new HashMap<>(); params2.put(TEST_PROTOTYPE_NAME, testName.getMethodName() + 2); params2.put(Constants.SERVICE_RANKING, "2"); params2.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, '/' + testName.getMethodName()); @@ -4294,12 +4278,12 @@ public class ServletTest extends BaseTest { @Test public void testWBServletDefaultContextAdaptor1() throws Exception{ BundleContext bundleContext = getBundleContext(); - Dictionary serviceProps = new Hashtable(); + Dictionary serviceProps = new Hashtable<>(); serviceProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/prototype/*"); TestServletPrototype testDriver = new TestServletPrototype(bundleContext); registrations.add(bundleContext.registerService(Servlet.class, testDriver, serviceProps)); - Dictionary helperProps = new Hashtable(); + Dictionary helperProps = new Hashtable<>(); helperProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "testContext" + testName.getMethodName()); helperProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/testContext"); helperProps.put(TEST_PATH_CUSTOMIZER_NAME, testName.getMethodName()); @@ -4307,7 +4291,7 @@ public class ServletTest extends BaseTest { ServiceRegistration pathAdaptorReg = null; try { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TEST_PROTOTYPE_NAME, testName.getMethodName()); params.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, '/' + testName.getMethodName()); params.put(STATUS_PARAM, testName.getMethodName()); @@ -4341,12 +4325,12 @@ public class ServletTest extends BaseTest { @Test public void testWBServletDefaultContextAdaptor2() throws Exception{ BundleContext bundleContext = getBundleContext(); - Dictionary serviceProps = new Hashtable(); + Dictionary serviceProps = new Hashtable<>(); serviceProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/prototype/*"); TestServletPrototype testDriver = new TestServletPrototype(bundleContext); registrations.add(bundleContext.registerService(Servlet.class, testDriver, serviceProps)); - Dictionary helperProps = new Hashtable(); + Dictionary helperProps = new Hashtable<>(); helperProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "testContext" + testName.getMethodName()); helperProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/testContext"); helperProps.put(TEST_PATH_CUSTOMIZER_NAME, testName.getMethodName()); @@ -4354,7 +4338,7 @@ public class ServletTest extends BaseTest { ServiceRegistration pathAdaptorReg = null; try { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TEST_PROTOTYPE_NAME, testName.getMethodName()); params.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, '/' + testName.getMethodName()); params.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=" + "testContext" + testName.getMethodName() + ")"); @@ -4389,13 +4373,13 @@ public class ServletTest extends BaseTest { @Test public void testWBServletDefaultContextAdaptor3() throws Exception{ BundleContext bundleContext = getBundleContext(); - Dictionary serviceProps = new Hashtable(); + Dictionary serviceProps = new Hashtable<>(); serviceProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/prototype/*"); TestServletPrototype testDriver = new TestServletPrototype(bundleContext); registrations.add(bundleContext.registerService(Servlet.class, testDriver, serviceProps)); // test the ContextPathCustomizer with a ServletContextHelper that has a '/' context path - Dictionary helperProps = new Hashtable(); + Dictionary helperProps = new Hashtable<>(); helperProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "testContext" + testName.getMethodName()); helperProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/"); helperProps.put(TEST_PATH_CUSTOMIZER_NAME, testName.getMethodName()); @@ -4403,7 +4387,7 @@ public class ServletTest extends BaseTest { ServiceRegistration pathAdaptorReg = null; try { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TEST_PROTOTYPE_NAME, testName.getMethodName()); params.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, '/' + testName.getMethodName()); params.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=" + "testContext" + testName.getMethodName() + ")"); @@ -4442,7 +4426,7 @@ public class ServletTest extends BaseTest { HttpContext testContext = new HttpContext() { @Override - public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException { + public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) { request.setAttribute(HttpContext.REMOTE_USER, "TEST"); request.setAttribute(HttpContext.AUTHENTICATION_TYPE, "Basic"); return true; @@ -4463,7 +4447,7 @@ public class ServletTest extends BaseTest { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { + throws IOException { resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); out.print("USER: " + req.getRemoteUser() + " AUTH_TYPE: " + req.getAuthType()); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/TestHttpServiceAndErrorPage.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/TestHttpServiceAndErrorPage.java index 1a550fa1b..2e0f499c1 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/TestHttpServiceAndErrorPage.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/TestHttpServiceAndErrorPage.java @@ -40,7 +40,7 @@ public class TestHttpServiceAndErrorPage extends BaseTest { try { final String name1 = "testname1"; final String name2 = "testname2"; - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put( HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, name1); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/TestHttpServiceAndNamedServlet.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/TestHttpServiceAndNamedServlet.java index ade206faf..5251ec791 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/TestHttpServiceAndNamedServlet.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/TestHttpServiceAndNamedServlet.java @@ -40,7 +40,7 @@ public class TestHttpServiceAndNamedServlet extends BaseTest { try { final String name1 = "testname1"; final String name2 = "testname2"; - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, name1); properties.put( diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/TestUpload.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/TestUpload.java index ed5804b14..ef537440c 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/TestUpload.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/TestUpload.java @@ -57,9 +57,8 @@ public class TestUpload extends BaseTest { } private void setupUploadServlet(final CountDownLatch receivedLatch, - final Map contents) - throws Exception { - final Dictionary servletProps = new Hashtable(); + final Map contents) { + final Dictionary servletProps = new Hashtable<>(); servletProps.put(HTTP_WHITEBOARD_SERVLET_PATTERN, "/post"); servletProps.put(HTTP_WHITEBOARD_SERVLET_MULTIPART_ENABLED, Boolean.TRUE); @@ -91,7 +90,7 @@ public class TestUpload extends BaseTest { } private void postContent(final URL resource, final int expectedRT) throws IOException { - Map> map = new HashMap>(); + Map> map = new HashMap<>(); map.put("method", Arrays.asList("POST")); map.put("text.txt", Arrays.asList(resource)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_11_3.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_11_3.java index 132255517..5920ec86b 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_11_3.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_11_3.java @@ -35,7 +35,7 @@ public class Test_140_11_3 extends BaseTest { public static final String CAPABILITY_OBJECTCLASS_ATTRIBUTE = "objectClass"; @Test - public void test_140_11_3() throws Exception { + public void test_140_11_3() { BundleContext context = getBundleContext(); ServiceReference srA = context.getServiceReference(HttpServiceRuntime.class); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_17to22.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_17to22.java index ab1802598..ea13b9689 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_17to22.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_17to22.java @@ -37,7 +37,7 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; public class Test_140_2_17to22 extends BaseTest { @Test - public void test_140_2_17to22() throws Exception { + public void test_140_2_17to22() { final BundleContext context = getBundleContext(); FindHook findHook = new FindHook() { @@ -65,9 +65,9 @@ public class Test_140_2_17to22 extends BaseTest { registrations.add(context.registerService(FindHook.class, findHook, null)); - AtomicReference sc1 = new AtomicReference(); + AtomicReference sc1 = new AtomicReference<>(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); ServiceRegistration serviceRegistration = context.registerService(ServletContextListener.class, new MockSCL(sc1), properties); registrations.add(serviceRegistration); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_26to27.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_26to27.java index a57e7509c..36331a88b 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_26to27.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_26to27.java @@ -37,27 +37,27 @@ public class Test_140_2_26to27 extends BaseTest { @SuppressWarnings("serial") @Test - public void test_140_2_26to27() throws Exception { + public void test_140_2_26to27() { BundleContext context = getBundleContext(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "foo"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/foo"); registrations.add(context.registerService(ServletContextHelper.class, new ServletContextHelper() {}, properties)); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "foobar"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/foo"); properties.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); registrations.add(context.registerService(ServletContextHelper.class, new ServletContextHelper() {}, properties)); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(osgi.http.whiteboard.context.name=foo)"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "first"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/bar/someServlet"); registrations.add(context.registerService(Servlet.class, new HttpServlet() {}, properties)); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(osgi.http.whiteboard.context.name=foobar)"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "second"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/bar/someServlet"); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_39to41.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_39to41.java index 4fe6f6be7..ef323f2bd 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_39to41.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_39to41.java @@ -32,15 +32,15 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; public class Test_140_2_39to41 extends BaseTest { @Test - public void test_140_2_39to41() throws Exception { + public void test_140_2_39to41() { BundleContext context = getBundleContext(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "foo"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/foo"); registrations.add(context.registerService(ServletContextHelper.class, new ServletContextHelper() {}, properties)); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "foo"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/foo/bar"); properties.put(Constants.SERVICE_RANKING, Integer.valueOf(1000)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_6_getResourcePaths.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_6_getResourcePaths.java index b089403c6..3d6cc2a0e 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_6_getResourcePaths.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_2_6_getResourcePaths.java @@ -36,7 +36,7 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; public class Test_140_2_6_getResourcePaths extends BaseTest { @Test - public void test_140_2_6_getResourcePaths() throws Exception { + public void test_140_2_6_getResourcePaths() { BundleContext context = getBundleContext(); final AtomicBoolean invoked = new AtomicBoolean(false); @@ -52,14 +52,14 @@ public class Test_140_2_6_getResourcePaths extends BaseTest { }; - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "context1"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/context1"); registrations.add(context.registerService(ServletContextHelper.class, servletContextHelper, properties)); - AtomicReference sc1 = new AtomicReference(); + AtomicReference sc1 = new AtomicReference<>(); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(osgi.http.whiteboard.context.name=context1)"); registrations.add(context.registerService(ServletContextListener.class, new MockSCL(sc1), properties)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_11to13.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_11to13.java index d396846fb..0660e0b67 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_11to13.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_11to13.java @@ -24,7 +24,6 @@ import java.util.Hashtable; import java.util.concurrent.atomic.AtomicBoolean; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -48,7 +47,7 @@ public class Test_140_4_11to13 extends BaseTest { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { invoked.set(true); @@ -62,7 +61,7 @@ public class Test_140_4_11to13 extends BaseTest { }; - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, ""); registrations.add(context.registerService(Servlet.class, servlet, properties)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_14to15.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_14to15.java index 1316e1864..2726da59a 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_14to15.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_14to15.java @@ -24,7 +24,6 @@ import java.util.Hashtable; import java.util.concurrent.atomic.AtomicBoolean; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -48,7 +47,7 @@ public class Test_140_4_14to15 extends BaseTest { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { invoked.set(true); @@ -62,7 +61,7 @@ public class Test_140_4_14to15 extends BaseTest { }; - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/"); registrations.add(context.registerService(Servlet.class, servlet, properties)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_16.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_16.java index a9ac513f5..151e9dffb 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_16.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_16.java @@ -24,7 +24,6 @@ import java.util.Hashtable; import java.util.concurrent.atomic.AtomicBoolean; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -47,7 +46,7 @@ public class Test_140_4_16 extends BaseTest { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { invoked.set(true); @@ -61,7 +60,7 @@ public class Test_140_4_16 extends BaseTest { }; - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, new String[] {"/a", "/fee/fi/foo/fum"}); registrations.add(context.registerService(Servlet.class, servlet, properties)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_17to22.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_17to22.java index bd5139c9d..4a94a7359 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_17to22.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_17to22.java @@ -22,7 +22,6 @@ import java.util.Dictionary; import java.util.Hashtable; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -48,7 +47,7 @@ public class Test_140_4_17to22 extends BaseTest { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { response.getWriter().write(content); } @@ -57,7 +56,7 @@ public class Test_140_4_17to22 extends BaseTest { } - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/a"); ServiceRegistration srA = getBundleContext().registerService(Servlet.class, new AServlet("a"), properties); @@ -65,7 +64,7 @@ public class Test_140_4_17to22 extends BaseTest { assertEquals("a", requestAdvisor.request("a")); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "b"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/a"); ServiceRegistration srB = getBundleContext().registerService(Servlet.class, new AServlet("b"), properties); @@ -83,7 +82,7 @@ public class Test_140_4_17to22 extends BaseTest { getServiceId(srB), failedServletDTO.serviceId); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "c"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/a"); properties.put(Constants.SERVICE_RANKING, 1000); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_1_22to23.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_1_22to23.java index 9fcdaa9ad..3e9daeeb4 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_1_22to23.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_1_22to23.java @@ -44,7 +44,7 @@ public class Test_140_4_1_22to23 extends BaseTest { class AServlet extends HttpServlet { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { response.sendError(HttpServletResponse.SC_BAD_GATEWAY, "a"); } @@ -54,19 +54,19 @@ public class Test_140_4_1_22to23 extends BaseTest { class BServlet extends HttpServlet { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException { invoked.set(true); throw new ServletException(); } } - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/a"); registrations.add(getBundleContext().registerService(Servlet.class, new AServlet(), properties)); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "b"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, HttpServletResponse.SC_BAD_GATEWAY + ""); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/b"); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_26to31.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_26to31.java index 2fe58e9b1..74ee6c92c 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_26to31.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_26to31.java @@ -23,7 +23,6 @@ import java.util.Dictionary; import java.util.Hashtable; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -52,7 +51,7 @@ public class Test_140_4_26to31 extends BaseTest { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { response.getWriter().write(content); } @@ -61,7 +60,7 @@ public class Test_140_4_26to31 extends BaseTest { } - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/a"); //properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(osgi.http.whiteboard.context.name=org_eclipse_equinox_http_servlet_internal_HttpServiceImpl_DefaultHttpContext-0)"); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_42to44.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_42to44.java index d56aa735b..27e7c73de 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_42to44.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_42to44.java @@ -60,13 +60,13 @@ public class Test_140_4_42to44 extends BaseTest { class BServlet extends HttpServlet { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { response.getWriter().write("failed"); } } - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/a"); registrations.add(getBundleContext().registerService(Servlet.class, new AServlet(), properties)); @@ -80,7 +80,7 @@ public class Test_140_4_42to44 extends BaseTest { // init failed, no servlet assertEquals("404", response.get("responseCode").get(0)); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/a"); registrations.add(getBundleContext().registerService(Servlet.class, new BServlet(), properties)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_9.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_9.java index 3b9dce65d..a89cada4e 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_9.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_4_9.java @@ -23,7 +23,6 @@ import java.util.Hashtable; import java.util.concurrent.atomic.AtomicBoolean; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -46,7 +45,7 @@ public class Test_140_4_9 extends BaseTest { @Override protected void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { invoked.set(true); @@ -55,7 +54,7 @@ public class Test_140_4_9 extends BaseTest { }; - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/*"); registrations.add(context.registerService(Servlet.class, servlet, properties)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_6_1.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_6_1.java index a89c91ee8..8dc15b958 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_6_1.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_6_1.java @@ -40,11 +40,11 @@ public class Test_140_6_1 extends BaseTest { public void test_140_6_1() throws Exception { BundleContext context = getBundleContext(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/*"); registrations.add(context.registerService(Servlet.class, new MockServlet().content("b"), properties)); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PATTERN, "/*"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PREFIX, "/org/eclipse/equinox/http/servlet/tests"); ServiceRegistration sr = context.registerService(Object.class, new Object(), properties); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_6_20to21_commonProperties.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_6_20to21_commonProperties.java index ee473cfce..25b543d22 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_6_20to21_commonProperties.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_6_20to21_commonProperties.java @@ -36,7 +36,7 @@ public class Test_140_6_20to21_commonProperties extends BaseTest { public void test_140_6_20to21_commonProperties() throws Exception { BundleContext context = getBundleContext(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PATTERN, "/other.txt"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PREFIX, "/org/eclipse/equinox/http/servlet/tests/index.txt"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(osgi.http.whiteboard.context.name=foo)"); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_7_validation.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_7_validation.java index ea71d846c..6ad737981 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_7_validation.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_7_validation.java @@ -38,10 +38,10 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; public class Test_140_7_validation extends BaseTest { @Test - public void test_140_7_validation() throws Exception { + public void test_140_7_validation() { BundleContext context = getBundleContext(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); ServiceRegistration sr = context.registerService( ServletContextListener.class, new MockSCL(new AtomicReference()), properties); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_9_ServletContextDTO_custom_listener.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_9_ServletContextDTO_custom_listener.java index aaeefc5cf..f8d8d13ec 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_9_ServletContextDTO_custom_listener.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_9_ServletContextDTO_custom_listener.java @@ -36,9 +36,9 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; public class Test_140_9_ServletContextDTO_custom_listener extends BaseTest { @Test - public void test_140_9_ServletContextDTO_custom_listener() throws Exception { + public void test_140_9_ServletContextDTO_custom_listener() { BundleContext context = getBundleContext(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/a"); registrations.add(context.registerService(ServletContextHelper.class, new ServletContextHelper() {}, properties)); @@ -46,9 +46,9 @@ public class Test_140_9_ServletContextDTO_custom_listener extends BaseTest { ServletContextDTO servletContextDTO = getServletContextDTOByName("a"); assertNotNull(servletContextDTO); - AtomicReference sc1 = new AtomicReference(); + AtomicReference sc1 = new AtomicReference<>(); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(osgi.http.whiteboard.context.name=a)"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); ServiceRegistration sr = context.registerService(ServletContextListener.class, new MockSCL(sc1), properties); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_9_ServletContextDTO_default_listener.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_9_ServletContextDTO_default_listener.java index d039ba425..c1bb49cf1 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_9_ServletContextDTO_default_listener.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_140_9_ServletContextDTO_default_listener.java @@ -35,14 +35,14 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; public class Test_140_9_ServletContextDTO_default_listener extends BaseTest { @Test - public void test_140_9_ServletContextDTO_default_listener() throws Exception { + public void test_140_9_ServletContextDTO_default_listener() { BundleContext context = getBundleContext(); ServletContextDTO servletContextDTO = getServletContextDTOByName(DEFAULT); assertNotNull(servletContextDTO); - AtomicReference sc1 = new AtomicReference(); + AtomicReference sc1 = new AtomicReference<>(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); ServiceRegistration sr = context.registerService(ServletContextListener.class, new MockSCL(sc1), properties); registrations.add(sr); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_NAME_bindUsingContextSelect.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_NAME_bindUsingContextSelect.java index b9a011f59..743792793 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_NAME_bindUsingContextSelect.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_NAME_bindUsingContextSelect.java @@ -33,18 +33,18 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; public class Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_NAME_bindUsingContextSelect extends BaseTest { @Test - public void test_table_140_1_HTTP_WHITEBOARD_CONTEXT_NAME_bindUsingContextSelect() throws Exception { + public void test_table_140_1_HTTP_WHITEBOARD_CONTEXT_NAME_bindUsingContextSelect() { BundleContext context = getBundleContext(); String contextName = "context1"; - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, contextName); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/context1"); registrations.add(context.registerService(ServletContextHelper.class, new ServletContextHelper() {}, properties)); - AtomicReference sc1 = new AtomicReference(); + AtomicReference sc1 = new AtomicReference<>(); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(osgi.http.whiteboard.context.name=" + contextName + ")"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); registrations.add(context.registerService(ServletContextListener.class, new MockSCL(sc1), properties)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_NAME_tieGoesToOldest.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_NAME_tieGoesToOldest.java index 1e3a637a0..99494b800 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_NAME_tieGoesToOldest.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_NAME_tieGoesToOldest.java @@ -34,25 +34,25 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; public class Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_NAME_tieGoesToOldest extends BaseTest { @Test - public void test_table_140_1_HTTP_WHITEBOARD_CONTEXT_NAME_tieGoesToOldest() throws Exception { + public void test_table_140_1_HTTP_WHITEBOARD_CONTEXT_NAME_tieGoesToOldest() { BundleContext context = getBundleContext(); String contextPath = "/context1"; - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, DEFAULT); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, contextPath); properties.put(Constants.SERVICE_RANKING, Integer.valueOf(1000)); registrations.add(context.registerService(ServletContextHelper.class, new ServletContextHelper() {}, properties)); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, DEFAULT); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/otherContext"); properties.put(Constants.SERVICE_RANKING, Integer.valueOf(1000)); registrations.add(context.registerService(ServletContextHelper.class, new ServletContextHelper() {}, properties)); - AtomicReference sc1 = new AtomicReference(); + AtomicReference sc1 = new AtomicReference<>(); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true"); registrations.add(context.registerService(ServletContextListener.class, new MockSCL(sc1), properties)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_PATH_type.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_PATH_type.java index 8ad80a51d..fd566da87 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_PATH_type.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_PATH_type.java @@ -33,10 +33,10 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; public class Test_table_140_1_HTTP_WHITEBOARD_CONTEXT_PATH_type extends BaseTest { @Test - public void test_table_140_1_HTTP_WHITEBOARD_CONTEXT_PATH_type() throws Exception { + public void test_table_140_1_HTTP_WHITEBOARD_CONTEXT_PATH_type() { BundleContext context = getBundleContext(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, "context"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, Boolean.FALSE); registrations.add(context.registerService(ServletContextHelper.class, new ServletContextHelper() {}, properties)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED.java index 030844012..7dba5e3b6 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED.java @@ -19,7 +19,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import java.io.IOException; import java.io.PrintWriter; import java.util.Dictionary; import java.util.Hashtable; @@ -54,7 +53,7 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED extends Ba final ExecutorService executor = Executors.newCachedThreadPool(); @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { + protected void doGet(HttpServletRequest req, HttpServletResponse resp) { doGetAsync(req.startAsync()); } @@ -79,7 +78,7 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED extends Ba } - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED, "true"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/a"); @@ -97,7 +96,7 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED extends Ba assertTrue(invoked.get()); invoked.set(false); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED, "false"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "b"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/b"); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED_validate.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED_validate.java index 62c6d72ec..fadc77fcf 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED_validate.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED_validate.java @@ -34,10 +34,10 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED_validate e @SuppressWarnings("serial") @Test - public void test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED_validate() throws Exception { + public void test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED_validate() { BundleContext context = getBundleContext(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED, "blah"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/a"); registrations.add(context.registerService(Servlet.class, new HttpServlet() {}, properties)); @@ -48,7 +48,7 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED_validate e assertNotNull(requestInfoDTO.servletDTO); assertFalse(requestInfoDTO.servletDTO.asyncSupported); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED, "true"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/b"); registrations.add(context.registerService(Servlet.class, new HttpServlet() {}, properties)); @@ -59,7 +59,7 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED_validate e assertNotNull(requestInfoDTO.servletDTO); assertTrue(requestInfoDTO.servletDTO.asyncSupported); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED, "false"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/c"); registrations.add(context.registerService(Servlet.class, new HttpServlet() {}, properties)); @@ -70,7 +70,7 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED_validate e assertNotNull(requestInfoDTO.servletDTO); assertFalse(requestInfoDTO.servletDTO.asyncSupported); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED, 234l); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/d"); registrations.add(context.registerService(Servlet.class, new HttpServlet() {}, properties)); @@ -81,7 +81,7 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED_validate e assertNotNull(requestInfoDTO.servletDTO); assertFalse(requestInfoDTO.servletDTO.asyncSupported); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/e"); registrations.add(context.registerService(Servlet.class, new HttpServlet() {}, properties)); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_4xx.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_4xx.java index a5f81b96b..ee06956fc 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_4xx.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_4xx.java @@ -29,7 +29,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -56,7 +55,7 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_4xx extends Bas class AServlet extends HttpServlet { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { response.sendError(HttpServletResponse.SC_FORBIDDEN, "a"); } @@ -66,7 +65,7 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_4xx extends Bas class BServlet extends HttpServlet { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { invoked.set(true); String message = (String) request.getAttribute(RequestDispatcher.ERROR_MESSAGE); response.getWriter().write((message == null) ? "" : message); @@ -74,13 +73,13 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_4xx extends Bas } - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/a"); registrations.add(context.registerService(Servlet.class, new AServlet(), properties)); // Register the 4xx (b) - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "b"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, "4xx"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/b"); @@ -98,7 +97,7 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_4xx extends Bas assertEquals(HttpServletResponse.SC_FORBIDDEN + "", response.get("responseCode").get(0)); // register a 4xx which will be shadowed (c) - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "c"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, "4xx"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/c"); @@ -109,7 +108,7 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_4xx extends Bas assertEquals(DTOConstants.FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE, failedErrorPageDTO.failureReason); // register a specific 404 which shouldn't shadow 4xx (b) - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "d"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, "404"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/d"); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_exception.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_exception.java index fb825e197..a901dbd1e 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_exception.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_exception.java @@ -56,7 +56,7 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_exception exten class AServlet extends HttpServlet { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException { throw new AException(); } @@ -66,7 +66,7 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_exception exten class BServlet extends HttpServlet { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { invoked.set(true); String exception = (String) request.getAttribute(RequestDispatcher.ERROR_EXCEPTION_TYPE); response.getWriter().write((exception == null) ? "" : exception); @@ -74,12 +74,12 @@ public class Test_table_140_4_HTTP_WHITEBOARD_SERVLET_ERROR_PAGE_exception exten } - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/a"); registrations.add(context.registerService(Servlet.class, new AServlet(), properties)); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "b"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, ServletException.class.getName()); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/error"); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_error.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_error.java index ab253f1a7..f7cb382d1 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_error.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_error.java @@ -25,7 +25,6 @@ import java.util.Map; import javax.servlet.Filter; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -45,7 +44,7 @@ public class Test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_error extends Ba public void test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_error() throws Exception { BundleContext context = getBundleContext(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_DISPATCHER, "ERROR"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_SERVLET, "a"); @@ -57,7 +56,7 @@ public class Test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_error extends Ba assertEquals(1, filterDTO.dispatcher.length); assertEquals("ERROR", filterDTO.dispatcher[0]); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE, "4xx"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/a"); @@ -73,13 +72,13 @@ public class Test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_error extends Ba MockServlet mockServlet = new MockServlet() { @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { response.sendError(HttpServletResponse.SC_NOT_FOUND); } }; - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "b"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/b"); ServiceRegistration srC = context.registerService(Servlet.class, mockServlet, properties); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_request.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_request.java index 19f922b95..23ccec7a0 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_request.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_request.java @@ -39,13 +39,13 @@ public class Test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_request extends public void test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_request() throws Exception { BundleContext context = getBundleContext(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/a"); ServiceRegistration srA = context.registerService(Filter.class, new MockFilter().around("b"), properties); registrations.add(srA); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/a"); ServiceRegistration srB = context.registerService(Servlet.class, new MockServlet().content("a"), properties); @@ -61,7 +61,7 @@ public class Test_table_140_5_HTTP_WHITEBOARD_FILTER_DISPATCHER_request extends assertEquals("bab", requestAdvisor.request("a")); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_DISPATCHER, "REQUEST"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/a"); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_PATTERN.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_PATTERN.java index bd2d91867..9f5d76d5f 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_PATTERN.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_PATTERN.java @@ -41,12 +41,12 @@ public class Test_table_140_5_HTTP_WHITEBOARD_FILTER_PATTERN extends BaseTest { public void test_table_140_5_HTTP_WHITEBOARD_FILTER_PATTERN() throws Exception { BundleContext context = getBundleContext(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, new String[] {"", "/"}); registrations.add(context.registerService(Servlet.class, new MockServlet().content("a"), properties)); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/**"); ServiceRegistration sr = context.registerService(Filter.class, new MockFilter().around("b"), properties); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_REGEX.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_REGEX.java index d2d89dd28..f91f12df2 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_REGEX.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_5_HTTP_WHITEBOARD_FILTER_REGEX.java @@ -43,12 +43,12 @@ public class Test_table_140_5_HTTP_WHITEBOARD_FILTER_REGEX extends BaseTest { public void test_table_140_5_HTTP_WHITEBOARD_FILTER_REGEX() throws Exception { BundleContext context = getBundleContext(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, new String[] {"", "/"}); registrations.add(context.registerService(Servlet.class, new MockServlet().content("a"), properties)); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME, "a"); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_REGEX, "**"); ServiceRegistration sr = context.registerService(Filter.class, new MockFilter().around("b"), properties); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_6_HTTP_WHITEBOARD_RESOURCE_validation.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_6_HTTP_WHITEBOARD_RESOURCE_validation.java index 9aab343b7..9bd6bc4d0 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_6_HTTP_WHITEBOARD_RESOURCE_validation.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/Test_table_140_6_HTTP_WHITEBOARD_RESOURCE_validation.java @@ -33,10 +33,10 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; public class Test_table_140_6_HTTP_WHITEBOARD_RESOURCE_validation extends BaseTest { @Test - public void test_table_140_6_HTTP_WHITEBOARD_RESOURCE_validation() throws Exception { + public void test_table_140_6_HTTP_WHITEBOARD_RESOURCE_validation() { BundleContext context = getBundleContext(); - Dictionary properties = new Hashtable(); + Dictionary properties = new Hashtable<>(); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PATTERN, 34l); properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PREFIX, "/org/eclipse/equinox/http/servlet/tests"); ServiceRegistration sr = context.registerService(Object.class, new Object(), properties); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/bundle/BundleInstaller.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/bundle/BundleInstaller.java index 4cb81478e..60604b68e 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/bundle/BundleInstaller.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/bundle/BundleInstaller.java @@ -15,15 +15,12 @@ package org.eclipse.equinox.http.servlet.tests.bundle; import java.io.IOException; - import java.net.URL; - import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import org.eclipse.osgi.service.urlconversion.URLConverter; - import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleException; @@ -33,13 +30,13 @@ import org.osgi.util.tracker.ServiceTracker; public class BundleInstaller { private BundleContext context; private String rootLocation; - private HashMap bundles = new HashMap(); + private HashMap bundles = new HashMap<>(); private ServiceTracker converter; public BundleInstaller(String bundlesRoot, BundleContext context) throws InvalidSyntaxException { this.context = context; rootLocation = bundlesRoot; - converter = new ServiceTracker(context, context.createFilter("(&(objectClass=" + URLConverter.class.getName() + ")(protocol=bundleentry))"), null); + converter = new ServiceTracker<>(context, context.createFilter("(&(objectClass=" + URLConverter.class.getName() + ")(protocol=bundleentry))"), null); converter.open(); } @@ -143,7 +140,7 @@ public class BundleInstaller { if (bundles == null) { return null; } - ArrayList result = new ArrayList(bundles.size()); + ArrayList result = new ArrayList<>(bundles.size()); for (Object element : bundles.values()) { Bundle bundle = (Bundle) element; try { diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/AsyncOutputServlet.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/AsyncOutputServlet.java index 3586572aa..691cac5ce 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/AsyncOutputServlet.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/AsyncOutputServlet.java @@ -16,7 +16,6 @@ package org.eclipse.equinox.http.servlet.tests.util; import java.io.IOException; import javax.servlet.AsyncContext; -import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.WriteListener; import javax.servlet.http.HttpServlet; @@ -28,7 +27,7 @@ public class AsyncOutputServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType("text/plain"); resp.setBufferSize(16); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseAsyncServlet.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseAsyncServlet.java index b51ce36ef..28746486a 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseAsyncServlet.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseAsyncServlet.java @@ -16,12 +16,10 @@ package org.eclipse.equinox.http.servlet.tests.util; import java.io.IOException; import java.io.PrintWriter; - import java.util.concurrent.Executors; import java.util.concurrent.ScheduledThreadPoolExecutor; import javax.servlet.AsyncContext; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -44,8 +42,7 @@ public class BaseAsyncServlet extends BaseServlet { @Override protected void service( - HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + HttpServletRequest request, HttpServletResponse response) { AsyncContext asyncContext = request.startAsync(request, response); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseChangeSessionIdServlet.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseChangeSessionIdServlet.java index 1cbceff63..f9ca47edc 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseChangeSessionIdServlet.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseChangeSessionIdServlet.java @@ -16,7 +16,6 @@ package org.eclipse.equinox.http.servlet.tests.util; import java.io.IOException; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -31,7 +30,7 @@ public class BaseChangeSessionIdServlet extends BaseServlet { @Override protected void service( HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { request.getSession(true); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseHttpContext.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseHttpContext.java index 251262c52..848f1a83b 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseHttpContext.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseHttpContext.java @@ -14,8 +14,6 @@ package org.eclipse.equinox.http.servlet.tests.util; -import java.io.IOException; - import java.net.URL; import javax.servlet.http.HttpServletRequest; @@ -38,7 +36,7 @@ public class BaseHttpContext implements HttpContext { @Override public boolean handleSecurity(HttpServletRequest request, - HttpServletResponse response) throws IOException { + HttpServletResponse response) { return handleSecurity; } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseServlet.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseServlet.java index 2b13c1daa..495a41ef0 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseServlet.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BaseServlet.java @@ -39,6 +39,7 @@ public class BaseServlet extends HttpServlet { this.content = content; } + @SuppressWarnings("unused") @Override protected void service( HttpServletRequest request, HttpServletResponse response) diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BufferedServlet.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BufferedServlet.java index e3548c1b0..472c24caf 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BufferedServlet.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/BufferedServlet.java @@ -17,7 +17,6 @@ package org.eclipse.equinox.http.servlet.tests.util; import java.io.IOException; import java.io.PrintWriter; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -30,7 +29,7 @@ public class BufferedServlet extends HttpServlet { @Override protected void service( HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { response.setContentType( "text/html" ); response.setBufferSize(value.length); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/DispatchResultServlet.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/DispatchResultServlet.java index 1005e85ec..a45b51eef 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/DispatchResultServlet.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/DispatchResultServlet.java @@ -19,7 +19,6 @@ import java.nio.charset.StandardCharsets; import javax.servlet.DispatcherType; import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -30,7 +29,7 @@ public class DispatchResultServlet extends HttpServlet { @Override protected void service( HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws IOException { StringWriter writer = new StringWriter(); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/EventHandler.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/EventHandler.java index f81701cd1..54d607f04 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/EventHandler.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/EventHandler.java @@ -43,7 +43,7 @@ public class EventHandler { // Ref: https://html.spec.whatwg.org/multipage/comms.html#server-sent-events - Map eventMap = new HashMap(); + Map eventMap = new HashMap<>(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); @@ -54,7 +54,7 @@ public class EventHandler { if (current.length() == 0) { handle(eventMap); - eventMap = new HashMap(); + eventMap = new HashMap<>(); continue; } diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/MockFilter.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/MockFilter.java index 30a3a4a27..4655fb8dd 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/MockFilter.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/MockFilter.java @@ -43,7 +43,7 @@ public class MockFilter implements Filter { } @Override - public void init(FilterConfig config) throws ServletException { + public void init(FilterConfig config) { } public MockFilter after(String after) { diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/ServletRequestAdvisor.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/ServletRequestAdvisor.java index 776e469fa..453ad66c9 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/ServletRequestAdvisor.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/ServletRequestAdvisor.java @@ -222,7 +222,7 @@ public class ServletRequestAdvisor extends Object { int responseCode = connection.getResponseCode(); - Map> map = new HashMap>(connection.getHeaderFields()); + Map> map = new HashMap<>(connection.getHeaderFields()); map.put("responseCode", Collections.singletonList(String.valueOf(responseCode))); InputStream stream; @@ -265,7 +265,7 @@ public class ServletRequestAdvisor extends Object { int responseCode = connection.getResponseCode(); - Map> map = new HashMap>(connection.getHeaderFields()); + Map> map = new HashMap<>(connection.getHeaderFields()); map.put("responseCode", Collections.singletonList(String.valueOf(responseCode))); InputStream stream; @@ -321,7 +321,7 @@ public class ServletRequestAdvisor extends Object { int responseCode = connection.getResponseCode(); - Map> map = new HashMap>(connection.getHeaderFields()); + Map> map = new HashMap<>(connection.getHeaderFields()); map.put("responseCode", Collections.singletonList(String.valueOf(responseCode))); InputStream stream; diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/TestServletPrototype.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/TestServletPrototype.java index bc537b3e4..86c0e57a8 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/TestServletPrototype.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/TestServletPrototype.java @@ -24,7 +24,6 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicReference; import javax.servlet.Servlet; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -41,16 +40,16 @@ public class TestServletPrototype extends HttpServlet { private static final long serialVersionUID = 1L; final BundleContext context; - final AtomicReference lastGetName = new AtomicReference(); - final AtomicReference lastUngetName = new AtomicReference(); - final ConcurrentMap factories = new ConcurrentHashMap(); + final AtomicReference lastGetName = new AtomicReference<>(); + final AtomicReference lastUngetName = new AtomicReference<>(); + final ConcurrentMap factories = new ConcurrentHashMap<>(); public TestServletPrototype(BundleContext context) { this.context = context; } @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { PrintWriter writer = response.getWriter(); try { @@ -62,7 +61,7 @@ public class TestServletPrototype extends HttpServlet { } class Factory implements PrototypeServiceFactory { - final AtomicReference> registration = new AtomicReference>(); + final AtomicReference> registration = new AtomicReference<>(); @Override public Servlet getService(Bundle bundle, ServiceRegistration registration) { String name = (String) registration.getReference().getProperty(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME); @@ -97,7 +96,7 @@ public class TestServletPrototype extends HttpServlet { } - protected void handleDoGet(HttpServletRequest request, HttpServletResponse response, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, HttpServletResponse response, PrintWriter writer) throws IOException { String pathInfo = request.getPathInfo(); if ("/lastGet".equals(pathInfo)) { writer.print(lastGetName.getAndSet(null)); @@ -124,7 +123,7 @@ public class TestServletPrototype extends HttpServlet { private static void configure(Factory factory, HttpServletRequest request) { // copy existing properties - Hashtable serviceProps = new Hashtable(); + Hashtable serviceProps = new Hashtable<>(); // Update ranking String serviceRanking = request.getParameter(Constants.SERVICE_RANKING); diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/TestWBServlet.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/TestWBServlet.java index fdff25404..6967002b3 100644 --- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/TestWBServlet.java +++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/util/TestWBServlet.java @@ -18,7 +18,6 @@ import java.io.PrintWriter; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -27,16 +26,16 @@ public class TestWBServlet extends HttpServlet { private static final long serialVersionUID = 1L; public static final String STATUS_PARAM = "status"; - private final AtomicReference status = new AtomicReference("none"); + private final AtomicReference status = new AtomicReference<>("none"); private final AtomicBoolean destroyed = new AtomicBoolean(false); @Override - public void init() throws ServletException { + public void init() { status.set(getServletConfig().getInitParameter(STATUS_PARAM)); } @Override - protected final void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + protected final void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { PrintWriter writer = response.getWriter(); try { handleDoGet(request, writer); @@ -45,7 +44,7 @@ public class TestWBServlet extends HttpServlet { } } - protected void handleDoGet(HttpServletRequest request, PrintWriter writer) throws ServletException, IOException { + protected void handleDoGet(HttpServletRequest request, PrintWriter writer) { if (destroyed.get()) { writer.print("destroyed"); } else { -- cgit v1.2.3