diff --git a/__tests__/distributors/dragonwell-installer.test.ts b/__tests__/distributors/dragonwell-installer.test.ts index 3e5b98b0..95518b00 100644 --- a/__tests__/distributors/dragonwell-installer.test.ts +++ b/__tests__/distributors/dragonwell-installer.test.ts @@ -206,5 +206,22 @@ describe('getAvailableVersions', () => { ); } ); + + it('should throw when required package type is not jdk', async () => { + const jdkVersion = '17'; + const arch = 'x64'; + const platform = 'linux'; + const distribution = new DragonwellDistribution({ + version: jdkVersion, + architecture: arch, + packageType: 'jre', + checkLatest: false + }); + mockPlatform(distribution, platform); + + await expect( + distribution['findPackageForDownload'](jdkVersion) + ).rejects.toThrow('Dragonwell provides only the `jdk` package type'); + }); }); }); diff --git a/dist/setup/index.js b/dist/setup/index.js index 57e8e279..bf0674d8 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -102658,6 +102658,9 @@ class DragonwellDistribution extends base_installer_1.JavaBase { if (!this.stable) { throw new Error('Early access versions are not supported'); } + if (this.packageType !== 'jdk') { + throw new Error('Dragonwell provides only the `jdk` package type'); + } const availableVersions = yield this.getAvailableVersions(); const matchedVersions = availableVersions .filter(item => { diff --git a/src/distributions/dragonwell/installer.ts b/src/distributions/dragonwell/installer.ts index 35a71c91..5a2f834c 100644 --- a/src/distributions/dragonwell/installer.ts +++ b/src/distributions/dragonwell/installer.ts @@ -30,6 +30,10 @@ export class DragonwellDistribution extends JavaBase { throw new Error('Early access versions are not supported'); } + if (this.packageType !== 'jdk') { + throw new Error('Dragonwell provides only the `jdk` package type'); + } + const availableVersions = await this.getAvailableVersions(); const matchedVersions = availableVersions