From fb7180e3b4b508fb5ceecb45c7db55608b54352c Mon Sep 17 00:00:00 2001 From: Volodymyr Siedlecki Date: Thu, 14 Dec 2023 11:01:59 -0500 Subject: [PATCH] Address code review comments --- .../ibm/ws/jsp23/fat/tests/JSPJava11Test.java | 15 ++++++++----- .../ibm/ws/jsp23/fat/tests/JSPJava17Test.java | 15 ++++++++----- .../ibm/ws/jsp23/fat/tests/JSPJava21Test.java | 15 ++++++++----- .../ibm/ws/jsp23/fat/tests/JSPJava8Test.java | 10 ++++++++- .../jspJava11Server/bootstrap.properties | 1 - .../servers/jspJava11Server/server.xml | 2 +- .../jspJava17Server/bootstrap.properties | 1 - .../servers/jspJava17Server/server.xml | 6 ++--- .../jspJava21Server/bootstrap.properties | 1 - .../servers/jspJava21Server/server.xml | 6 ++--- .../publish/servers/jspJava8Server/server.xml | 6 ++--- .../META-INF/permissions.xml | 22 ------------------- .../resources/WEB-INF/web.xml | 2 +- .../META-INF/permissions.xml | 22 ------------------- .../META-INF/permissions.xml | 22 ------------------- .../TestJSPWithJava21.war/resources/index.jsp | 3 +-- .../META-INF/permissions.xml | 22 ------------------- .../jsp/translator/compiler/JDTCompiler.java | 16 +++++++------- 18 files changed, 57 insertions(+), 130 deletions(-) delete mode 100644 dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava11.war/META-INF/permissions.xml delete mode 100644 dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava17.war/META-INF/permissions.xml delete mode 100644 dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava21.war/META-INF/permissions.xml delete mode 100644 dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava8.war/META-INF/permissions.xml diff --git a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava11Test.java b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava11Test.java index bdb0c02b0d12..eded92876326 100644 --- a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava11Test.java +++ b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava11Test.java @@ -39,15 +39,12 @@ /** * JSP 2.3 tests which use Java 11 specific features. * - * Tests must only run when Java 11 is in use. Runs only in FULL as Java 8 and 17 test also cover these options. - * - * Tests that just need to drive a simple request using our WebBrowser object can be placed in this class. + * Tests must only run when Java 11 is in use. * */ -// No need to run against cdi-2.0 since these tests don't use CDI at all. @Mode(TestMode.FULL) @MinimumJavaLevel(javaLevel = 11) -@SkipForRepeat("CDI-2.0") +@SkipForRepeat("CDI-2.0") // No need to run against cdi-2.0 since these tests don't use CDI at all. @RunWith(FATRunner.class) public class JSPJava11Test { private static final String APP_NAME = "TestJSPWithJava11"; @@ -96,6 +93,14 @@ public void testJava11JSP() throws Exception { assertTrue("Java 11's Map copyOf method failed", response.getText().contains("{key=success-copyof}")); } + /** + * Same test as testJava11JSP, but using the runtime JDK (via JSP's useJDKCompiler option rather than the default Eclipse Compiler for Java (ECJ)) + * + * https://openliberty.io/docs/latest/reference/config/jspEngine.html + * + * @throws Exception if something goes horribly wrong + * + */ @Test public void testJava11viaUseJDKCompiler() throws Exception { diff --git a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava17Test.java b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava17Test.java index 3fd8da1df481..38eb10e26ea2 100644 --- a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava17Test.java +++ b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava17Test.java @@ -38,14 +38,11 @@ /** * JSP 2.3 tests which use Java 17 specific features. * - * Tests must only run when Java 17 is in use. - * - * Tests that just need to drive a simple request using our WebBrowser object can be placed in this class. + * Tests must only run when Java 17 or later is in use. * */ -// No need to run against cdi-2.0 since these tests don't use CDI at all. @MinimumJavaLevel(javaLevel = 17) -@SkipForRepeat("CDI-2.0") +@SkipForRepeat("CDI-2.0") // No need to run against cdi-2.0 since these tests don't use CDI at all. @RunWith(FATRunner.class) public class JSPJava17Test { private static final String APP_NAME = "TestJSPWithJava17"; @@ -93,6 +90,14 @@ public void testJava17JSP() throws Exception { assertTrue("The response did not contain: success", response.getText().contains("success-pattern-matching")); } + /** + * Same test as testJava17JSP, but using the runtime JDK (via JSP's useJDKCompiler option rather than the default Eclipse Compiler for Java (ECJ)) + * + * https://openliberty.io/docs/latest/reference/config/jspEngine.html + * + * @throws Exception if something goes horribly wrong + * + */ @Test public void testJava17viaUseJDKCompiler() throws Exception { diff --git a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava21Test.java b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava21Test.java index bbcb94c28608..277702840dfb 100644 --- a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava21Test.java +++ b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava21Test.java @@ -40,15 +40,12 @@ /** * JSP 2.3 tests which use Java 21 specific features. * - * Tests must only run when Java 21 is in use. - * - * Tests that just need to drive a simple request using our WebBrowser object can be placed in this class. + * Tests must only run when Java 21 or later is in use. * */ -// No need to run against cdi-2.0 since these tests don't use CDI at all. @Mode(TestMode.FULL) @MinimumJavaLevel(javaLevel = 21) -@SkipForRepeat("CDI-2.0") +@SkipForRepeat("CDI-2.0") // No need to run against cdi-2.0 since these tests don't use CDI at all. @RunWith(FATRunner.class) public class JSPJava21Test { private static final String APP_NAME = "TestJSPWithJava21"; @@ -96,6 +93,14 @@ public void testJava21JSP() throws Exception { assertTrue("The response did not contain: success", response.getText().contains("switch success!")); } + /** + * Same test as testJava21JSP, but using the runtime JDK (via JSP's useJDKCompiler option rather than the default Eclipse Compiler for Java (ECJ)) + * + * https://openliberty.io/docs/latest/reference/config/jspEngine.html + * + * @throws Exception if something goes horribly wrong + * + */ @Test public void testJava21viaUseJDKCompiler() throws Exception { diff --git a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava8Test.java b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava8Test.java index 51479e07a4e5..edce9f057aa7 100644 --- a/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava8Test.java +++ b/dev/com.ibm.ws.jsp.2.3_fat/fat/src/com/ibm/ws/jsp23/fat/tests/JSPJava8Test.java @@ -36,7 +36,7 @@ /** * JSP 2.3 tests which use Java 1.8 specific features. * - * Tests must only run when Java 1.8 is in use. + * Tests must only run when Java 1.8 or later is in use. * * Tests that just need to drive a simple request using our WebBrowser object can be placed in this class. * @@ -89,6 +89,14 @@ public void testJava8JSP() throws Exception { assertTrue("The response did not contain: onetwothreefour", response.getText().contains("onetwothreefour")); } + /** + * Same test as testJava8JSP, but using the runtime JDK (via JSP's useJDKCompiler option rather than the default Eclipse Compiler for Java (ECJ)) + * + * https://openliberty.io/docs/latest/reference/config/jspEngine.html + * + * @throws Exception if something goes horribly wrong + * + */ @Test public void testJava8viaUseJDKCompiler() throws Exception { diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/bootstrap.properties b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/bootstrap.properties index 1df2a95eff71..60261fb0a132 100644 --- a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/bootstrap.properties +++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/bootstrap.properties @@ -9,4 +9,3 @@ ############################################################################### bootstrap.include=../testports.properties osgi.console=7777 -com.ibm.ws.logging.trace.specification=*=info:com.ibm.ws.webcontainer*=all:com.ibm.wsspi.webcontainer*=all:HTTPChannel=all:TCPChannel=all:GenericBNF=all:com.ibm.ws.jsp*=all diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/server.xml b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/server.xml index cc9226985ed8..9b51fb777a74 100644 --- a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/server.xml +++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava11Server/server.xml @@ -16,7 +16,7 @@ localConnector-1.0 - + diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/bootstrap.properties b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/bootstrap.properties index 1df2a95eff71..60261fb0a132 100644 --- a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/bootstrap.properties +++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/bootstrap.properties @@ -9,4 +9,3 @@ ############################################################################### bootstrap.include=../testports.properties osgi.console=7777 -com.ibm.ws.logging.trace.specification=*=info:com.ibm.ws.webcontainer*=all:com.ibm.wsspi.webcontainer*=all:HTTPChannel=all:TCPChannel=all:GenericBNF=all:com.ibm.ws.jsp*=all diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/server.xml b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/server.xml index 7d65b5933efb..3d46d454d553 100644 --- a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/server.xml +++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava17Server/server.xml @@ -16,10 +16,8 @@ localConnector-1.0 - - - - + + diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/bootstrap.properties b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/bootstrap.properties index 1df2a95eff71..60261fb0a132 100644 --- a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/bootstrap.properties +++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/bootstrap.properties @@ -9,4 +9,3 @@ ############################################################################### bootstrap.include=../testports.properties osgi.console=7777 -com.ibm.ws.logging.trace.specification=*=info:com.ibm.ws.webcontainer*=all:com.ibm.wsspi.webcontainer*=all:HTTPChannel=all:TCPChannel=all:GenericBNF=all:com.ibm.ws.jsp*=all diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/server.xml b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/server.xml index 49fd719e4ef5..97b8034b4d1e 100644 --- a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/server.xml +++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava21Server/server.xml @@ -16,10 +16,8 @@ localConnector-1.0 - - - - + + diff --git a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava8Server/server.xml b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava8Server/server.xml index 4cd37b71f284..aee1afa843dc 100644 --- a/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava8Server/server.xml +++ b/dev/com.ibm.ws.jsp.2.3_fat/publish/servers/jspJava8Server/server.xml @@ -1,5 +1,5 @@ - - + + diff --git a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava11.war/META-INF/permissions.xml b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava11.war/META-INF/permissions.xml deleted file mode 100644 index 75cec1550725..000000000000 --- a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava11.war/META-INF/permissions.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - java.lang.RuntimePermission - getClassLoader - - - diff --git a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava11.war/resources/WEB-INF/web.xml b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava11.war/resources/WEB-INF/web.xml index 6c0fe3ace877..2fc1b54f8a2e 100644 --- a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava11.war/resources/WEB-INF/web.xml +++ b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava11.war/resources/WEB-INF/web.xml @@ -14,6 +14,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> - TestJSPWithJava17 + TestJSPWithJava11 diff --git a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava17.war/META-INF/permissions.xml b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava17.war/META-INF/permissions.xml deleted file mode 100644 index 75cec1550725..000000000000 --- a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava17.war/META-INF/permissions.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - java.lang.RuntimePermission - getClassLoader - - - diff --git a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava21.war/META-INF/permissions.xml b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava21.war/META-INF/permissions.xml deleted file mode 100644 index 75cec1550725..000000000000 --- a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava21.war/META-INF/permissions.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - java.lang.RuntimePermission - getClassLoader - - - diff --git a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava21.war/resources/index.jsp b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava21.war/resources/index.jsp index 03ffcb61a702..368ca24bfeb4 100644 --- a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava21.war/resources/index.jsp +++ b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava21.war/resources/index.jsp @@ -33,5 +33,4 @@ } %> - - \ No newline at end of file + diff --git a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava8.war/META-INF/permissions.xml b/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava8.war/META-INF/permissions.xml deleted file mode 100644 index 75cec1550725..000000000000 --- a/dev/com.ibm.ws.jsp.2.3_fat/test-applications/TestJSPWithJava8.war/META-INF/permissions.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - java.lang.RuntimePermission - getClassLoader - - - diff --git a/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/JDTCompiler.java b/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/JDTCompiler.java index ecd50bd78e5d..830870ae9143 100644 --- a/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/JDTCompiler.java +++ b/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/compiler/JDTCompiler.java @@ -107,14 +107,14 @@ public JspCompilerResult compile(JspResources[] jspResources, JspResources[] dep compilerOptionsMap.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE); compilerOptionsMap.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE); compilerOptionsMap.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE); - compilerOptionsMap.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.PRESERVE); + compilerOptionsMap.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.PRESERVE); } compilerOptionsMap.put(CompilerOptions.OPTION_Encoding, javaEncoding); if (javaSourceLevel != -1) { compilerOptionsMap.put(CompilerOptions.OPTION_Source, javaSourceLevel.toString()); - compilerOptionsMap.put(CompilerOptions.OPTION_Compliance, javaSourceLevel.toString()); - compilerOptionsMap.put(CompilerOptions.OPTION_TargetPlatform, javaSourceLevel.toString()); + compilerOptionsMap.put(CompilerOptions.OPTION_Compliance, javaSourceLevel.toString()); + compilerOptionsMap.put(CompilerOptions.OPTION_TargetPlatform, javaSourceLevel.toString()); } else if (jdkSourceLevel == 14) { compilerOptionsMap.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4); @@ -128,20 +128,20 @@ else if (jdkSourceLevel == 15) { } //PM04610 start else if (jdkSourceLevel == 16) { - compilerOptionsMap.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6); + compilerOptionsMap.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6); compilerOptionsMap.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6); // 341708 compilerOptionsMap.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6); // 412312 } //PM04610 end else if (jdkSourceLevel == 17) { - compilerOptionsMap.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7); - compilerOptionsMap.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_7); + compilerOptionsMap.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7); + compilerOptionsMap.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_7); compilerOptionsMap.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7); } //126902 start else if (jdkSourceLevel == 18) { - compilerOptionsMap.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); - compilerOptionsMap.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); + compilerOptionsMap.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); + compilerOptionsMap.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); compilerOptionsMap.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); } //126902 end