mirror of
https://github.com/actions/setup-java.git
synced 2026-06-16 16:38:50 +00:00
Always fall back to legacy AdoptOpenJDK but log all Temurin failures
- Change error handling to gracefully fall back for all errors, not just version-not-found - Log version-not-found errors as notices with migration guidance - Log other Temurin failures as debug messages for troubleshooting - Improves resilience: users always get a result even if Temurin API has issues - Maintains visibility: failures are still logged for debugging
This commit is contained in:
parent
7d2d456be4
commit
5d3f13625c
11
dist/setup/index.js
vendored
11
dist/setup/index.js
vendored
@ -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.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user