From 49b34f3f12cf8d385f9ff45d362e8f77ad3992c4 Mon Sep 17 00:00:00 2001
From: Dmitry Shibanov <dmitry-shibanov@github.com>
Date: Mon, 13 Dec 2021 16:46:03 +0300
Subject: [PATCH] throw error if version is not stable

---
 dist/setup/index.js                      | 3 +++
 src/distributions/microsoft/installer.ts | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/dist/setup/index.js b/dist/setup/index.js
index 855880b7..79a28c2d 100644
--- a/dist/setup/index.js
+++ b/dist/setup/index.js
@@ -13886,6 +13886,9 @@ class MicrosoftDistributions extends base_installer_1.JavaBase {
             if (this.architecture !== 'x64' && this.architecture !== 'aarch64') {
                 throw new Error(`Unsupported architecture: ${this.architecture}`);
             }
+            if (!this.stable) {
+                throw new Error('Unstable versions are not supported');
+            }
             const availableVersionsRaw = yield this.getAvailableVersions();
             const opts = this.getPlatformOption();
             const availableVersions = availableVersionsRaw.map(item => ({
diff --git a/src/distributions/microsoft/installer.ts b/src/distributions/microsoft/installer.ts
index 79fffe5e..9afb695e 100644
--- a/src/distributions/microsoft/installer.ts
+++ b/src/distributions/microsoft/installer.ts
@@ -40,6 +40,11 @@ export class MicrosoftDistributions extends JavaBase {
     if (this.architecture !== 'x64' && this.architecture !== 'aarch64') {
       throw new Error(`Unsupported architecture: ${this.architecture}`);
     }
+
+    if (!this.stable) {
+      throw new Error('Unstable versions are not supported');
+    }
+
     const availableVersionsRaw = await this.getAvailableVersions();
 
     const opts = this.getPlatformOption();