@@ -44,7 +44,10 @@ export async function getJava(
4444 allowRetries : true ,
4545 maxRetries : 3
4646 } ) ;
47- const url = version . includes ( '-ea' ) ? 'https://cdn.zulu.org/zulu/ea/' : 'https://cdn.zulu.org/zulu/releases/' ;
47+ const ZULU_BASE_URL = 'https://cdn.zulu.org/zulu' ;
48+ const url = version . includes ( '-ea' )
49+ ? `${ ZULU_BASE_URL } /ea/`
50+ : `${ ZULU_BASE_URL } /releases/` ;
4851 const response = await http . get ( url ) ;
4952 const statusCode = response . message . statusCode || 0 ;
5053 if ( statusCode < 200 || statusCode > 299 ) {
@@ -60,7 +63,7 @@ export async function getJava(
6063
6164 const contents = await response . readBody ( ) ;
6265 const refs = contents . match ( / < a h r e f .* \" > / gi) || [ ] ;
63- const downloadInfo = getDownloadInfo ( refs , version , javaPackage ) ;
66+ const downloadInfo = getDownloadInfo ( refs , version , javaPackage , url ) ;
6467 jdkFile = await tc . downloadTool ( downloadInfo . url ) ;
6568 version = downloadInfo . version ;
6669 compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz' ;
@@ -188,7 +191,8 @@ async function unzipJavaDownload(
188191function getDownloadInfo (
189192 refs : string [ ] ,
190193 version : string ,
191- javaPackage : string
194+ javaPackage : string ,
195+ baseUrl : string
192196) : { version : string ; url : string } {
193197 version = normalizeVersion ( version ) ;
194198 let extension = '' ;
@@ -231,9 +235,7 @@ function getDownloadInfo(
231235 // If we haven't returned, means we're looking at the correct platform
232236 let versions = ref . match ( pkgRegexp ) || [ ] ;
233237 if ( versions . length > 1 ) {
234- throw new Error (
235- `Invalid ref received from https://static.azul.com/zulu/bin/: ${ ref } `
236- ) ;
238+ throw new Error ( `Invalid ref received from ${ baseUrl } : ${ ref } ` ) ;
237239 }
238240 if ( versions . length == 0 ) {
239241 return ;
@@ -243,8 +245,7 @@ function getDownloadInfo(
243245 if ( semver . satisfies ( refVersion , version ) ) {
244246 versionMap . set (
245247 refVersion ,
246- 'https://static.azul.com/zulu/bin/' +
247- ref . slice ( '<a href="' . length , ref . length - '">' . length )
248+ `${ baseUrl } ` + ref . slice ( '<a href="' . length , ref . length - '">' . length )
248249 ) ;
249250 }
250251 } ) ;
@@ -263,7 +264,7 @@ function getDownloadInfo(
263264
264265 if ( curUrl == '' ) {
265266 throw new Error (
266- `No valid download found for version ${ version } and package ${ javaPackage } . Check https://static.azul.com/zulu/bin/ for a list of valid versions or download your own jdk file and add the jdkFile argument`
267+ `No valid download found for version ${ version } and package ${ javaPackage } . Check ${ baseUrl } for a list of valid versions or download your own jdk file and add the jdkFile argument`
267268 ) ;
268269 }
269270
0 commit comments