Skip to content

Commit 5ddd092

Browse files
authored
Merge pull request #130 from openequella/release/1.3.0
Release/1.3.0
2 parents 5ea269f + 7fec8be commit 5ddd092

26 files changed

+120
-53
lines changed

.github/workflows/ci.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
build:
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
2222

2323
- name: Gradle Cache
2424
uses: actions/cache@v3
@@ -31,10 +31,10 @@ jobs:
3131
${{ runner.os }}-gradle-
3232
3333
- name: Set up JDK
34-
uses: actions/setup-java@v3
34+
uses: actions/setup-java@v4
3535
with:
3636
distribution: temurin
37-
java-version: 11
37+
java-version: 21
3838

3939
- name: Build with Gradle
4040
run: ./gradlew build
@@ -44,13 +44,13 @@ jobs:
4444
working-directory: build/distributions
4545

4646
- name: Save artefacts
47-
uses: actions/upload-artifact@v3.1.2
47+
uses: actions/upload-artifact@v4.0.0
4848
with:
4949
name: Artefacts
5050
path: build/distributions
5151

5252
- name: Save Coverage Report
53-
uses: actions/upload-artifact@v3.1.2
53+
uses: actions/upload-artifact@v4.0.0
5454
with:
5555
name: CoverageReport
5656
path: build/reports/tests/test

.idea/misc.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ unable to find valid certification path to requested target
5353

5454
This is because the Java Keystore used by the admin console package does not recognize the Root CA certificate used to sign openEQUELLA's SSL certificate.
5555

56-
The admin-console-package uses its own copy of the JRE, in the `jdk-11.0.18+10-jre` folder.
57-
The keystore we need to update is within this folder, at the path `jdk-11.0.18+10-jre/lib/security/cacerts`.
56+
The admin-console-package uses its own copy of the JRE, in the `jdk-21.0.1+12-jre` folder.
57+
The keystore we need to update is within this folder, at the path `jdk-21.0.1+12-jre/lib/security/cacerts`.
5858

5959
The bundled JRE comes with a command line tool which you can use for updating these keystores, called `keytool`.
60-
This should work in Mac, Linux and Windows. It is stored in `jdk-11.0.18+10-jre/bin`.
60+
This should work in Mac, Linux and Windows. It is stored in `jdk-21.0.1+12-jre/bin`.
6161

6262
**NOTE:**
6363

@@ -72,7 +72,7 @@ You will need a copy of the Root CA certificate used to sign your SSL certificat
7272
in which case you should use whatever it was set to.
7373

7474
```
75-
keytool -import -trustcacerts -keystore path/to/adminconsolepackage/jdk-11.0.18+10-jre/lib/security/cacerts -storepass changeit -alias giveYourCertANameHere -file path/to/rootCA.pem
75+
keytool -import -trustcacerts -keystore path/to/adminconsolepackage/jdk-21.0.1+12-jre/lib/security/cacerts -storepass changeit -alias giveYourCertANameHere -file path/to/rootCA.pem
7676
```
7777

7878
The command will display the certificate and prompt the user to `Trust this certificate? [no]:`. Type `yes` and hit Enter.

build.gradle

+22-18
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@ repositories {
1616
}
1717

1818
dependencies {
19-
implementation 'org.slf4j:slf4j-api:2.0.7'
20-
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
19+
implementation 'org.slf4j:slf4j-api:2.0.11'
20+
implementation 'com.fasterxml.jackson.core:jackson-databind:2.16.1'
2121
implementation 'org.jasypt:jasypt:1.9.3'
22-
runtimeOnly 'org.slf4j:slf4j-simple:2.0.7'
22+
runtimeOnly 'org.slf4j:slf4j-simple:2.0.11'
2323
testImplementation "junit:junit:$junitVersion"
2424
}
2525

2626
group = 'org.apereo.openequella.adminconsole'
2727
version = System.getenv("TRAVIS_TAG") ?: artifactVersion
28-
mainClassName = 'org.apereo.openequella.adminconsole.launcher.ClientLauncher'
28+
application {
29+
mainClass = 'org.apereo.openequella.adminconsole.launcher.ClientLauncher'
30+
}
2931

3032
license {
3133
strictCheck
@@ -37,14 +39,15 @@ jar {
3739
manifest {
3840
attributes('Implementation-Title': project.name,
3941
'Implementation-Version': project.version,
40-
'Main-Class': mainClassName,
42+
'Main-Class': application.mainClass,
4143
"Class-Path": configurations.runtimeClasspath.files.collect { it.getName() }.join(' '))
4244
}
4345
}
4446

45-
final jreDownloadDir = file("$buildDir/jre-downloads")
47+
final buildDirectory = getLayout().getBuildDirectory()
48+
final jreDownloadDir = buildDirectory.dir("jre-downloads").get().asFile
4649
final jreExtractDir = {sys -> "${jreDownloadDir.absolutePath}/jre/${sys}"}
47-
final jarDir = "${buildDir}/libs"
50+
final jarDir = buildDirectory.dir("libs").get().asFile
4851
final launcherScripts = [
4952
windows: 'Windows-launcher.bat',
5053
linux: 'Linux-launcher.sh',
@@ -54,26 +57,27 @@ final launcherScripts = [
5457
class JreProperties {
5558
String hash
5659
String fileName
57-
String getDownloadUrl() {"https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.18%2B10/${fileName}"}
60+
String getDownloadUrl() {"https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.1%2B12/${fileName}"}
5861
File getJre() {new File("build/jre-downloads/${fileName}")}
5962
}
6063

6164
final jreProperties = [
6265
windows: new JreProperties(
63-
hash: 'dea0fe7fd5fc52cf5e1d3db08846b6a26238cfcc36d5527d1da6e3cb059071b3',
64-
fileName: 'OpenJDK11U-jre_x64_windows_hotspot_11.0.18_10.zip'),
66+
hash: '38bb68f9db9c85a63496570c53a1bcbac18c808677595d7e939d2f5b38e9a7aa',
67+
fileName: 'OpenJDK21U-jre_x64_windows_hotspot_21.0.1_12.zip'),
6568
linux: new JreProperties(
66-
hash: '0e7b196ef8603ac3d38caaf7768b7b0a3c613d60e15a6511bcfb2c894b609e99',
67-
fileName: 'OpenJDK11U-jre_x64_linux_hotspot_11.0.18_10.tar.gz'),
69+
hash: '277f4084bee875f127a978253cfbaad09c08df597feaf5ccc82d2206962279a3',
70+
fileName: 'OpenJDK21U-jre_x64_linux_hotspot_21.0.1_12.tar.gz'),
6871
mac: new JreProperties(
69-
hash: '7c73b1a731fc840f2ecb5633906d687bfee4346a8191d3cb1c4370168b16351f',
70-
fileName: 'OpenJDK11U-jre_x64_mac_hotspot_11.0.18_10.tar.gz')
72+
hash: 'c21a2648ec21bc4701acfb6b7a1fd90aca001db1efb8454e2980d4c8dcd9e310',
73+
fileName: 'OpenJDK21U-jre_x64_mac_hotspot_21.0.1_12.tar.gz')
7174
]
7275

7376
task copyDependencies(type: Copy, description: 'Copy dependencies to /build/libs') {
74-
from configurations.default
77+
from configurations.runtimeClasspath
7578
into(jarDir)
7679
}
80+
copyDependencies.mustRunAfter(startScripts)
7781

7882
task downloadJre(description: 'Download OpenJRE of Linux, Windows and Mac') {
7983
doFirst {
@@ -85,7 +89,7 @@ task downloadJre(description: 'Download OpenJRE of Linux, Windows and Mac') {
8589
.collect {String sys, JreProperties props ->
8690
Thread.start {
8791
println("Start downloading OpenJRE for ${sys}...")
88-
new URL(props.downloadUrl as String).withInputStream {
92+
new URI(props.downloadUrl as String).toURL().withInputStream {
8993
props.jre.newOutputStream() << it
9094
}
9195
}
@@ -150,8 +154,8 @@ distributions {
150154
"${sys}Packages" {
151155
distributionBaseName = "admin-console-package-for-${sys}"
152156
contents {
153-
from("${buildDir}") {
154-
include "libs/*"
157+
into("libs") {
158+
from {jarDir}
155159
}
156160
from {file(jreExtractDir(sys))}
157161
from {file(scriptFileDir)}

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
junitVersion=4.13.2
2-
artifactVersion=1.2.1
2+
artifactVersion=1.3.0

gradle/wrapper/gradle-wrapper.jar

50 Bytes
Binary file not shown.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

launcher-scripts/Linux-launcher.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
OLD_JAVA_HOME=$JAVA_HOME
33
SCRIPT_DIRECTORY=`readlink -f "$(dirname "$0")"`
4-
export JAVA_HOME=$SCRIPT_DIRECTORY/jdk-11.0.18+10-jre
4+
export JAVA_HOME=$SCRIPT_DIRECTORY/jdk-21.0.1+12-jre
55
"$JAVA_HOME/bin/java" -DLAUNCHER_JAVA_PATH="$JAVA_HOME/bin/java" -jar "$SCRIPT_DIRECTORY/libs/admin.jar"
66
export JAVA_HOME=$OLD_JAVA_HOME

launcher-scripts/Mac-launcher.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/zsh
22
OLD_JAVA_HOME=$JAVA_HOME
33
SCRIPT_DIRECTORY=${0:A:h}
4-
export JAVA_HOME=$SCRIPT_DIRECTORY/jdk-11.0.18+10-jre/Contents/Home
4+
export JAVA_HOME=$SCRIPT_DIRECTORY/jdk-21.0.1+12-jre/Contents/Home
55
"$JAVA_HOME/bin/java" -DLAUNCHER_JAVA_PATH="$JAVA_HOME/bin/java" -jar "$SCRIPT_DIRECTORY/libs/admin.jar"
66
export JAVA_HOME=$OLD_JAVA_HOME

launcher-scripts/Windows-launcher.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@echo off
22
set OLD_JAVA_HOME="%JAVA_HOME%"
33
set "BAT_DIRECTORY=%~dp0"
4-
set "JAVA_HOME=%BAT_DIRECTORY%jdk-11.0.18+10-jre"
4+
set "JAVA_HOME=%BAT_DIRECTORY%jdk-21.0.1+12-jre"
55
start "Admin console launcher" /D "%BAT_DIRECTORY%\libs" "%JAVA_HOME%\bin\javaw" -DLAUNCHER_JAVA_PATH="%JAVA_HOME%\bin\java" -jar admin.jar
66
set JAVA_HOME="%OLD_JAVA_HOME%"
77
set OLD_JAVA_HOME=""

settings.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
rootProject.name = 'admin-console-launcher'
2-
include 'launcher'

src/main/java/org/apereo/openequella/adminconsole/launcher/ClientLauncher.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.apereo.openequella.adminconsole.swing.ServerPicker;
2727
import org.apereo.openequella.adminconsole.swing.TableLayout;
2828
import org.apereo.openequella.adminconsole.util.BlindSSLSocketFactory;
29+
import org.apereo.openequella.adminconsole.util.IconUtil;
2930
import org.apereo.openequella.adminconsole.util.Proxy;
3031
import org.slf4j.Logger;
3132
import org.slf4j.LoggerFactory;
@@ -72,7 +73,6 @@ public class ClientLauncher extends JFrame implements ActionListener, WindowList
7273
private final JButton makeDefaultServerButton;
7374
private final JButton editProxyButton;
7475
private final JButton launchButton;
75-
private final Image icon;
7676

7777
public static void main(String args[]) throws Exception {
7878
new ClientLauncher();
@@ -92,8 +92,8 @@ public ClientLauncher() {
9292
makeDefaultServerButton = new JButton(MAKE_DEFAULT_SERVER_BUTTON);
9393
launchButton = new JButton(LAUNCH_BUTTON);
9494

95-
icon = new ImageIcon(getClass().getResource("/adminconsoleicon.png")).getImage();
96-
setIconImage(icon);
95+
setIconImages(IconUtil.ICONS);
96+
9797
setTitle(WINDOW_TITLE);
9898
setResizable(false);
9999
addWindowListener(this);
@@ -194,7 +194,7 @@ private static Config readConfig() {
194194

195195
private void launch(final ServerProfile serverProfile) {
196196
final SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
197-
final LoadingDialog loadingDialog = new LoadingDialog(ClientLauncher.this, icon, LOADING_DIALOG_TITLE);
197+
final LoadingDialog loadingDialog = new LoadingDialog(ClientLauncher.this, IconUtil.ICONS, LOADING_DIALOG_TITLE);
198198

199199
@Override
200200
public Object doInBackground() throws Exception {

src/main/java/org/apereo/openequella/adminconsole/launcher/LoadingDialog.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import java.awt.Dimension;
2121
import java.awt.Image;
22+
import java.util.List;
2223

2324
import javax.swing.JDialog;
2425
import javax.swing.JFrame;
@@ -29,12 +30,12 @@
2930
public class LoadingDialog extends JDialog {
3031
private static final long serialVersionUID = 1L;
3132

32-
public LoadingDialog(JFrame parent, Image icon, String title) {
33+
public LoadingDialog(JFrame parent, List<Image> icons, String title) {
3334
super(parent);
3435
setTitle(title);
3536
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
3637
setUndecorated(true);
37-
setIconImage(icon);
38+
setIconImages(icons);
3839
setSize(new Dimension(200, 30));
3940
final JProgressBar loadingProgressBar = new JProgressBar();
4041
loadingProgressBar.setIndeterminate(true);

src/main/java/org/apereo/openequella/adminconsole/service/JarService.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.InputStream;
2626
import java.io.InputStreamReader;
2727
import java.net.HttpURLConnection;
28+
import java.net.URI;
2829
import java.net.URL;
2930
import java.nio.file.Files;
3031
import java.nio.file.StandardCopyOption;
@@ -84,7 +85,7 @@ public void downloadJar(String jarName) {
8485
// hit the server to download
8586
//final URL url = new URL(baseUrl + "/console.do?jar=" + URLEncoder.encode(jarName + ".jar", "utf-8"));
8687
final String strUrl = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + "adminconsole.jar";
87-
final URL url = new URL(strUrl);
88+
final URL url = new URI(strUrl).toURL();
8889
HttpURLConnection conn = null;
8990
try {
9091
conn = (HttpURLConnection) url.openConnection();

src/main/java/org/apereo/openequella/adminconsole/util/BlindSSLSocketFactory.java

+11-12
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import org.slf4j.Logger;
3737
import org.slf4j.LoggerFactory;
3838

39-
public class BlindSSLSocketFactory extends SSLSocketFactory {
39+
public class BlindSSLSocketFactory extends SSLSocketFactory implements AutoCloseable {
4040
private static final Logger LOGGER = LoggerFactory.getLogger(BlindSSLSocketFactory.class);
4141
private static SSLSocketFactory originalFactory;
4242
private static HostnameVerifier originalHostnameVerifier;
@@ -101,17 +101,6 @@ public boolean verify(String hostname, SSLSession session) {
101101
}
102102
}
103103

104-
@Override
105-
protected void finalize() throws Throwable {
106-
if (originalFactory != null) {
107-
HttpsURLConnection.setDefaultSSLSocketFactory(originalFactory);
108-
}
109-
if (originalHostnameVerifier != null) {
110-
HttpsURLConnection.setDefaultHostnameVerifier(originalHostnameVerifier);
111-
}
112-
super.finalize();
113-
}
114-
115104
@Override
116105
public Socket createSocket(String arg0, int arg1) throws IOException {
117106
return blindFactory.createSocket(arg0, arg1);
@@ -147,4 +136,14 @@ public String[] getDefaultCipherSuites() {
147136
public String[] getSupportedCipherSuites() {
148137
return blindFactory.getSupportedCipherSuites();
149138
}
139+
140+
@Override
141+
public void close() {
142+
if (originalFactory != null) {
143+
HttpsURLConnection.setDefaultSSLSocketFactory(originalFactory);
144+
}
145+
if (originalHostnameVerifier != null) {
146+
HttpsURLConnection.setDefaultHostnameVerifier(originalHostnameVerifier);
147+
}
148+
}
150149
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Licensed to The Apereo Foundation under one or more contributor license
3+
* agreements. See the NOTICE file distributed with this work for additional
4+
* information regarding copyright ownership.
5+
*
6+
* The Apereo Foundation licenses this file to you under the Apache License,
7+
* Version 2.0, (the "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at:
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package org.apereo.openequella.adminconsole.util;
19+
20+
import org.slf4j.Logger;
21+
import org.slf4j.LoggerFactory;
22+
23+
import javax.imageio.ImageIO;
24+
import java.awt.*;
25+
import java.io.IOException;
26+
import java.net.URL;
27+
import java.util.Arrays;
28+
import java.util.List;
29+
import java.util.Objects;
30+
import java.util.stream.Collectors;
31+
32+
public final class IconUtil {
33+
private static final Logger LOGGER = LoggerFactory.getLogger(IconUtil.class);
34+
private static final int[] ICON_SIZES = {16, 24, 32, 48, 64, 72, 96, 128, 256};
35+
public static final List<Image> ICONS;
36+
37+
static {
38+
ICONS =
39+
Arrays.stream(ICON_SIZES)
40+
.mapToObj(IconUtil::getIconURL)
41+
.map(
42+
icon -> {
43+
try {
44+
return ImageIO.read(icon);
45+
} catch (IOException e) {
46+
LOGGER.error("Failed to load icon: ", e);
47+
return null;
48+
}
49+
})
50+
.filter(Objects::nonNull)
51+
.collect(Collectors.toList());
52+
}
53+
54+
private static URL getIconURL(int dim) {
55+
String path = "/adminconsoleicon." + dim + "x" + dim + "px.png";
56+
return Objects.requireNonNull(
57+
IconUtil.class.getResource(path), "Failed to get icon of: " + path);
58+
}
59+
60+
private IconUtil() {
61+
throw new UnsupportedOperationException("Utility class cannot be instantiated");
62+
}
63+
}
Loading
873 Bytes
Loading
1.31 KB
Loading
Loading
Loading
3.31 KB
Loading
4.62 KB
Loading
Loading
7.52 KB
Loading
-1.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)