diff --git a/dist/setup/index.js b/dist/setup/index.js index 0d4176d2..18c4633e 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -77847,16 +77847,15 @@ class AdoptDistribution extends base_installer_1.JavaBase { return yield this.temurinDistribution.findPackageForDownload(version); } catch (error) { - // Only fall back to legacy AdoptOpenJDK for version-not-found errors - if (error instanceof Error && - error.message.includes('No matching version found')) { + // Log the failure but always fall back to legacy AdoptOpenJDK for resilience + const errorMessage = error instanceof Error ? error.message : String(error); + if (errorMessage.includes('No matching version found')) { core.notice('The JVM you are looking for could not be found in the Temurin repository, this likely indicates ' + 'that you are using an out of date version of Java, consider updating and moving to using the Temurin distribution type in setup-java.'); } else { - // Rethrow unexpected errors to avoid masking real issues - core.debug(`Unexpected error from Temurin lookup: ${error instanceof Error ? error.message : String(error)}`); - throw error; + // Log other errors for debugging but gracefully fall back + core.debug(`Temurin lookup failed: ${errorMessage}. Falling back to AdoptOpenJDK API.`); } } } diff --git a/src/distributions/adopt/installer.ts b/src/distributions/adopt/installer.ts index a8c6f57b..edfc0f3b 100644 --- a/src/distributions/adopt/installer.ts +++ b/src/distributions/adopt/installer.ts @@ -71,21 +71,18 @@ export class AdoptDistribution extends JavaBase { try { return await this.temurinDistribution.findPackageForDownload(version); } catch (error) { - // Only fall back to legacy AdoptOpenJDK for version-not-found errors - if ( - error instanceof Error && - error.message.includes('No matching version found') - ) { + // Log the failure but always fall back to legacy AdoptOpenJDK for resilience + const errorMessage = error instanceof Error ? error.message : String(error); + if (errorMessage.includes('No matching version found')) { core.notice( 'The JVM you are looking for could not be found in the Temurin repository, this likely indicates ' + 'that you are using an out of date version of Java, consider updating and moving to using the Temurin distribution type in setup-java.' ); } else { - // Rethrow unexpected errors to avoid masking real issues + // Log other errors for debugging but gracefully fall back core.debug( - `Unexpected error from Temurin lookup: ${error instanceof Error ? error.message : String(error)}` + `Temurin lookup failed: ${errorMessage}. Falling back to AdoptOpenJDK API.` ); - throw error; } } }