diff --git a/.github/workflows/camunda.yml b/.github/workflows/camunda.yml index 5293c785..f6317fc4 100644 --- a/.github/workflows/camunda.yml +++ b/.github/workflows/camunda.yml @@ -33,10 +33,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 8 + - name: Set up JDK 11 uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '11' distribution: 'temurin' cache: maven @@ -156,10 +156,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 8 + - name: Set up JDK 11 uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '11' distribution: 'temurin' cache: maven @@ -257,10 +257,10 @@ jobs: - name: Check out the repo uses: actions/checkout@v3 - - name: Set up JDK 8 + - name: Set up JDK 11 uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '11' distribution: 'temurin' cache: maven diff --git a/.github/workflows/ldap.yml b/.github/workflows/ldap.yml index e7cb56d1..77287c8e 100644 --- a/.github/workflows/ldap.yml +++ b/.github/workflows/ldap.yml @@ -33,10 +33,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 8 + - name: Set up JDK 11 uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '11' distribution: 'temurin' cache: maven diff --git a/cws-adaptation-engine/pom.xml b/cws-adaptation-engine/pom.xml index 96e1b24c..30f07f7c 100644 --- a/cws-adaptation-engine/pom.xml +++ b/cws-adaptation-engine/pom.xml @@ -155,8 +155,7 @@ maven-compiler-plugin ${maven-compiler-plugin.version} - ${java.version} - ${java.version} + ${java.version} diff --git a/cws-adaptation/pom.xml b/cws-adaptation/pom.xml index 6acb1ec9..2d66d110 100644 --- a/cws-adaptation/pom.xml +++ b/cws-adaptation/pom.xml @@ -51,8 +51,7 @@ maven-compiler-plugin ${maven-compiler-plugin.version} - ${java.version} - ${java.version} + ${java.version} diff --git a/cws-certs/generate-certs.sh b/cws-certs/generate-certs.sh index 9abaf669..a6c1e03b 100755 --- a/cws-certs/generate-certs.sh +++ b/cws-certs/generate-certs.sh @@ -3,13 +3,13 @@ # the following bash script creates open-source certs required to access CWS # create private key and self-signed certificate within a keystore -keytool -genkey -keyalg RSA -dname "cn=cws, ou=cws, o=cws, l=cws, s=FL, c=US" -alias cws -keypass changeit -keystore .keystore -storepass changeit -validity 360 -keysize 2048 +keytool -genkey -keyalg RSA -dname "cn=cws, ou=cws, o=cws, l=cws, s=FL, c=US" -alias cws -keypass changeit -keystore .keystore -storepass changeit -storetype JKS -validity 360 -keysize 2048 # extract self-signed certificate from keystore keytool -export -alias cws -file cws.crt -keystore .keystore -storepass changeit # insert self-signed certificate into truststore -keytool -import -alias cws -file cws.crt -keypass changeit -noprompt -keystore cws_truststore.jks -storepass changeit +keytool -import -alias cws -file cws.crt -keypass changeit -noprompt -keystore cws_truststore.jks -storepass changeit -storetype JKS # place open-source certs in appropriate directories cp .keystore ../install diff --git a/cws-core/pom.xml b/cws-core/pom.xml index 0e4139e5..bc65788c 100644 --- a/cws-core/pom.xml +++ b/cws-core/pom.xml @@ -169,8 +169,7 @@ maven-compiler-plugin ${maven-compiler-plugin.version} - ${java.version} - ${java.version} + ${java.version} diff --git a/cws-core/src/main/java/jpl/cws/core/code/CodeService.java b/cws-core/src/main/java/jpl/cws/core/code/CodeService.java index 19d184dc..add04930 100644 --- a/cws-core/src/main/java/jpl/cws/core/code/CodeService.java +++ b/cws-core/src/main/java/jpl/cws/core/code/CodeService.java @@ -3,13 +3,11 @@ import java.io.File; import java.io.IOException; import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; import javax.tools.Diagnostic; import javax.tools.DiagnosticCollector; @@ -60,19 +58,23 @@ public void afterPropertiesSet() throws Exception { // Construct the set of URLs File outputDir = new File(TEMP_DIR_PATH); - URLClassLoader cl = ((URLClassLoader) (Thread.currentThread().getContextClassLoader())); - URLClassLoader parent = cl; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + ClassLoader parent = cl; while (parent != null) { - for (URL url : parent.getURLs()) { - urls.add(url); - log.trace("CC ["+parent+"] URL: " + url); + if (parent.getClass().getName().equals("java.net.URLClassLoader")) { + try { + Method getURLsMethod = parent.getClass().getMethod("getURLs"); + URL[] urlsArray = (URL[]) getURLsMethod.invoke(parent); + for (URL url : urlsArray) { + urls.add(url); + log.trace("CC ["+parent+"] URL: " + url); + } + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + log.error("Error accessing getURLs() method on classloader: " + parent, e); + } } - parent = (URLClassLoader) parent.getParent(); // traverse up chain.. - } - - if (cl != null) { - cl.close(); + parent = parent.getParent(); // traverse up the chain } urls.add(outputDir.toURI().toURL()); @@ -329,5 +331,5 @@ public void persistInProgressCode(String code) { public String getTempDirPath() { return TEMP_DIR_PATH; } - + } diff --git a/cws-engine-service/pom.xml b/cws-engine-service/pom.xml index 6ef1f7e6..61ed3149 100644 --- a/cws-engine-service/pom.xml +++ b/cws-engine-service/pom.xml @@ -227,8 +227,7 @@ maven-compiler-plugin ${maven-compiler-plugin.version} - ${java.version} - ${java.version} + ${java.version} diff --git a/cws-engine/pom.xml b/cws-engine/pom.xml index 46d7e2b5..85518252 100644 --- a/cws-engine/pom.xml +++ b/cws-engine/pom.xml @@ -36,8 +36,7 @@ maven-compiler-plugin ${maven-compiler-plugin.version} - ${java.version} - ${java.version} + ${java.version} diff --git a/cws-installer/pom.xml b/cws-installer/pom.xml index 38b1fc1c..7f827adc 100644 --- a/cws-installer/pom.xml +++ b/cws-installer/pom.xml @@ -82,8 +82,7 @@ maven-compiler-plugin ${maven-compiler-plugin.version} - ${java.version} - ${java.version} + ${java.version} diff --git a/cws-service/pom.xml b/cws-service/pom.xml index cf086cd3..d3ab0ddf 100644 --- a/cws-service/pom.xml +++ b/cws-service/pom.xml @@ -54,6 +54,11 @@ javax.servlet-api + + javax.annotation + javax.annotation-api + + org.tuckey urlrewritefilter @@ -262,8 +267,7 @@ maven-compiler-plugin ${maven-compiler-plugin.version} - ${java.version} - ${java.version} + ${java.version} diff --git a/cws-tasks/pom.xml b/cws-tasks/pom.xml index 2bf52e96..0112b1d3 100644 --- a/cws-tasks/pom.xml +++ b/cws-tasks/pom.xml @@ -107,8 +107,7 @@ maven-compiler-plugin ${maven-compiler-plugin.version} - ${java.version} - ${java.version} + ${java.version} diff --git a/cws-test/pom.xml b/cws-test/pom.xml index cea6d459..5981ca52 100644 --- a/cws-test/pom.xml +++ b/cws-test/pom.xml @@ -78,6 +78,10 @@ org.seleniumhq.selenium selenium-chrome-driver + + org.seleniumhq.selenium + selenium-http-jdk-client + junit @@ -115,6 +119,13 @@ + + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + + org.jacoco jacoco-maven-plugin diff --git a/cws-test/src/test/java/jpl/cws/test/WebTestUtil.java b/cws-test/src/test/java/jpl/cws/test/WebTestUtil.java index 78c205ff..9d54f43b 100644 --- a/cws-test/src/test/java/jpl/cws/test/WebTestUtil.java +++ b/cws-test/src/test/java/jpl/cws/test/WebTestUtil.java @@ -112,9 +112,11 @@ public void quitDriver() { protected void initChromeDriver() { + // indicate that Java 11+ HTTP client needs to be used + System.setProperty("webdriver.http.factory", "jdk-http-client"); ChromeOptions chromeOptions = new ChromeOptions(); - // Turn on headless mode for Bamboo + // Turn on headless mode for GitHub Actions chromeOptions.addArguments("--headless=new"); chromeOptions.setAcceptInsecureCerts(true); chromeOptions.addArguments("--window-size=1920,1080"); diff --git a/cws-test/src/test/resources/configure_with_jacoco.sh b/cws-test/src/test/resources/configure_with_jacoco.sh index a37f72ce..1f6c8156 100755 --- a/cws-test/src/test/resources/configure_with_jacoco.sh +++ b/cws-test/src/test/resources/configure_with_jacoco.sh @@ -48,13 +48,13 @@ else exit 1 fi -if [[ "$java_version" > "1.8" && "$java_version" < "1.9" ]]; then - echo " Java version == 1.8x [OK]" +if [[ "$java_version" > "11" && "$java_version" < "12" ]]; then + echo " Java version == 11x [OK]" else echo " +-------+----------------------------------------------------" echo " | ERROR | " echo " +-------+ " - echo " | Java version is less than 1.8. Must run with java 1.8x " + echo " | Java version is less than 11. Must run with Java 11x " echo " | Aborting program... " echo "--------------------------------------------------------------" exit 1 diff --git a/cws-ui/pom.xml b/cws-ui/pom.xml index 08c37ff2..783300dd 100644 --- a/cws-ui/pom.xml +++ b/cws-ui/pom.xml @@ -46,8 +46,7 @@ maven-compiler-plugin ${maven-compiler-plugin.version} - ${java.version} - ${java.version} + ${java.version} diff --git a/pom.xml b/pom.xml index a674faa2..fff5930e 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 1.2.132 0.8.2 - 1.8 + 11 1.4.7 2.6 1.1 @@ -57,7 +57,7 @@ 2.7.1b3 2.7.2 - 3.6.1 + 3.8.0 3.0.1 3.1.0 2.5.2 @@ -73,7 +73,7 @@ 2.3.2 4.8.3 3.1.0 - + 2.17.1 2.17.1 false @@ -249,6 +249,12 @@ provided + + javax.annotation + javax.annotation-api + 1.3.2 + + org.apache.tomcat @@ -551,11 +557,12 @@ ${selenium.version} test - + - io.netty - netty-codec - 4.1.91.Final + org.seleniumhq.selenium + selenium-http-jdk-client + ${selenium.version} + test org.jacoco diff --git a/utils.sh b/utils.sh index 5955a44e..ee487f91 100644 --- a/utils.sh +++ b/utils.sh @@ -152,10 +152,10 @@ function check_java_requirements () { exit 1 fi - if [[ "${JAVA_PATH_VERSION}" > "1.8" && "${JAVA_PATH_VERSION}" < "1.9" ]]; then - print " Java version == 1.8x [OK]" + if [[ "${JAVA_PATH_VERSION}" > "11" && "${JAVA_PATH_VERSION}" < "12" ]]; then + print " Java version == 11x [OK]" else - print " ERROR: Java version is ${JAVA_PATH_VERSION}. CWS only supports Java version 1.8x." + print " ERROR: Java version is ${JAVA_PATH_VERSION}. CWS only supports Java version 11x." exit 1 fi