diff --git a/vscode/src/constants.ts b/vscode/src/constants.ts
index 4c112b26..4844e354 100644
--- a/vscode/src/constants.ts
+++ b/vscode/src/constants.ts
@@ -26,12 +26,13 @@ export namespace extConstants {
}
export namespace jdkDownloaderConstants {
- export const JDK_RELEASES_TRACK_URL = `https://www.java.com/releases/releases.json`;
+
+ export const ORACLE_JDK_RELEASES_BASE_URL = `https://java.oraclecloud.com/currentJavaReleases`;
export const ORACLE_JDK_BASE_DOWNLOAD_URL = `https://download.oracle.com/java`;
- export const ORACLE_JDK_DOWNLOAD_VERSIONS = ['23', '21'];
-
+ export const ORACLE_JDK_FALLBACK_VESIONS = ['24', '21'];
+
export const OPEN_JDK_VERSION_DOWNLOAD_LINKS: { [key: string]: string } = {
"23": "https://download.java.net/java/GA/jdk23.0.2/6da2a6609d6e406f85c491fcb119101b/7/GPL/openjdk-23.0.2"
};
diff --git a/vscode/src/test/unit/webviews/jdkDownloader/view.unit.test.ts b/vscode/src/test/unit/webviews/jdkDownloader/view.unit.test.ts
index 9362eec3..0b21b115 100644
--- a/vscode/src/test/unit/webviews/jdkDownloader/view.unit.test.ts
+++ b/vscode/src/test/unit/webviews/jdkDownloader/view.unit.test.ts
@@ -20,6 +20,7 @@ import * as sinon from 'sinon';
import { WebviewPanel, window } from 'vscode';
import { JdkDownloaderView } from '../../../../webviews/jdkDownloader/view';
import { checkTagContentNotEmpty, enableMockedLoggers, getMachineArch, getOsType } from '../../testUtils';
+import * as utils from '../../../../utils';
describe('JDK Downloader view tests', () => {
let jdkDownloaderView: JdkDownloaderView;
@@ -44,6 +45,21 @@ describe('JDK Downloader view tests', () => {
beforeEach(() => {
createWebviewPanelStub = sandbox.stub(window, 'createWebviewPanel');
onDidReceiveMessageStub = sandbox.stub();
+ let versionsStub: sinon.SinonStub = sandbox.stub(utils, "httpsGet");
+ versionsStub.returns(`{
+ "items": [
+ {
+ "jdkDetails":{
+ "jdkVersion": 23
+ }
+ },
+ {
+ "jdkDetails":{
+ "jdkVersion": 21
+ }
+ }
+ ]
+ }`);
webviewPanel = {
webview: {
@@ -132,13 +148,6 @@ describe('JDK Downloader view tests', () => {
expect(jdkDownloaderHtml).to.match(archOptionRegex);
});
});
-
- it("should attach a message listener to the webview", () => {
- expect(onDidReceiveMessageStub.calledOnce).to.be.true;
- const listener = onDidReceiveMessageStub.firstCall.args[0];
- expect(listener).to.be.a('function');
- });
-
});
it("should dispose the webview", () => {
diff --git a/vscode/src/webviews/jdkDownloader/view.ts b/vscode/src/webviews/jdkDownloader/view.ts
index 48126adb..17085b72 100644
--- a/vscode/src/webviews/jdkDownloader/view.ts
+++ b/vscode/src/webviews/jdkDownloader/view.ts
@@ -21,6 +21,7 @@ import { JdkDownloaderAction } from './action';
import { downloaderCss } from './styles';
import { l10n } from '../../localiser';
import { LOGGER } from '../../logger';
+import { httpsGet, isError, isString } from '../../utils';
export class JdkDownloaderView {
public static readonly OPEN_JDK_LABEL = "OpenJDK";
@@ -31,8 +32,9 @@ export class JdkDownloaderView {
private jdkDownloaderWebView?: WebviewPanel;
private osType?: string;
private machineArch?: string;
+ private oracleJdkVersions: string[] = [];
- public createView = () => {
+ public createView = async () => {
try {
LOGGER.log("Creating JDK downloader webview");
this.jdkDownloaderWebView = window.createWebviewPanel(
@@ -43,6 +45,7 @@ export class JdkDownloaderView {
enableScripts: true
}
);
+ this.oracleJdkVersions = await this.getOracleJdkVersions();
this.setDropdownOptions();
this.jdkDownloaderWebView.webview.html = this.fetchJdkDownloadViewHtml();
this.jdkDownloaderWebView.webview.onDidReceiveMessage(message => {
@@ -111,7 +114,7 @@ export class JdkDownloaderView {