Skip to content

Fix disco client JDK download action#8682

Merged
ebarboni merged 1 commit intoapache:deliveryfrom
mbien:fix-disco-download
Jul 29, 2025
Merged

Fix disco client JDK download action#8682
ebarboni merged 1 commit intoapache:deliveryfrom
mbien:fix-disco-download

Conversation

@mbien
Copy link
Member

@mbien mbien commented Jul 28, 2025

ephemeral id stopped working for some reason, but I noticed that it had the same value as the regular id field.

Using getPkgInfoByPkgId() which uses the regular id does appear to work.

how to test:
try to download a JDK using the java platform manager. It would fail during the download step.

targets delivery

@mbien mbien added this to the NB27 milestone Jul 28, 2025
@mbien mbien requested a review from neilcsmith-net July 28, 2025 09:04
@mbien mbien added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Jul 28, 2025
Copy link
Member

@neilcsmith-net neilcsmith-net left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably look at upgrading Disco Client?

This looks like foojayio/discoclient@6825e2c

Not against making this change too, if we're sure it's the right approach, but probably better to change the method name to match the delegated API.

@mbien
Copy link
Member Author

mbien commented Jul 28, 2025

upgrading made no difference, the exception was just different

ephemeral id stopped working for some reason, but I noticed
that it had the same value as the regular id field.

Using getPkgInfoByPkgId() which uses the regular id does appear to
work.
@mbien mbien force-pushed the fix-disco-download branch from 3ac1884 to 0e18f08 Compare July 28, 2025 13:50
Copy link
Member

@neilcsmith-net neilcsmith-net left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks for confirming. The JSON passed into the Pkg constructor doesn't seem to have an ephemeral ID, which that commit looks to fix, but I guess the resulting query still doesn't work either. Other methods in DiscoClient are odd in that some use ephemeral IDs with API v3 only and some only without API v3. The paths for them don't seem to be in the API docs for the service either?!

Thanks for the method name change.

@mbien
Copy link
Member Author

mbien commented Jul 28, 2025

here the reproducer replicating the calls outside of NB for anyone interested

Details
        DiscoClient client = new DiscoClient();
        
        Distribution distribution = client.getDistributions()
                .stream()
                .filter(d -> d.getName().equalsIgnoreCase("zulu"))
                .findFirst()
                .get();
        
        System.out.println("dist: "+distribution);
        
        List<Pkg> pkgs = client.getPkgs(
                List.of(distribution),
                VersionNumber.fromText("21"),
                Latest.NONE,
                OperatingSystem.LINUX,
                LibCType.NONE,
                Architecture.NONE,
                Bitness.NONE,
                ArchiveType.NONE,
                PackageType.JDK,
                Boolean.FALSE,
                Boolean.TRUE,
                List.of(ReleaseStatus.GA, ReleaseStatus.EA),
                TermOfSupport.LTS,
                List.of(Scope.PUBLIC),
                null
        );
        
        for (Pkg pkg : pkgs) {
            System.out.println("pkg: "+pkg);
            
            // on 21.0.1 and 2.0.39: Exception in thread "main" java.lang.NullPointerException: Cannot invoke "com.google.gson.JsonArray.size()" because "jsonArray" is null
            // on 2.0.24: Exception in thread "main" java.lang.IllegalArgumentException: ephemeralId or javaVersion cannot be null
            System.out.println("info: "+client.getPkgInfoByEphemeralId(pkg.getEphemeralId(), pkg.getJavaVersion()));
        }

@ebarboni ebarboni merged commit a8cbebf into apache:delivery Jul 29, 2025
36 checks passed
@mbien mbien linked an issue Jul 30, 2025 that may be closed by this pull request
@FolkertMeeuw
Copy link

Good morning Michael (not brother from Adam),

I will test it immediately. Thanks for support.

@FolkertMeeuw
Copy link

Workaround steps:

  1. Download zulu from ZULU Website
  2. Install the .dmg of zulu
  3. Configure NetBeans Java Platform against zulu
folkert@MacBook-Pro-von-Folkert Documents % /usr/libexec/java_home -V                  
Matching Java Virtual Machines (4):
    23.0.1 (arm64) "Homebrew" - "OpenJDK 23.0.1" /opt/homebrew/Cellar/openjdk/23.0.1/libexec/openjdk.jdk/Contents/Home
    21.0.8 (arm64) "Eclipse Adoptium" - "OpenJDK 21.0.8" /Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home
    17.0.16 (arm64) "Azul Systems, Inc." - "Zulu 17.60.17" /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home
    11.0.27 (arm64) "Homebrew" - "OpenJDK 11.0.27" /opt/homebrew/Cellar/openjdk@11/11.0.27/libexec/openjdk.jdk/Contents/Home
/opt/homebrew/Cellar/openjdk/23.0.1/libexec/openjdk.jdk/Contents/Home

@mbien
Copy link
Member Author

mbien commented Jul 31, 2025

something changed in the endpoint over night so the download is currently failing with rc2 too unfortunately. Running #8682 (comment) against 2.0.39 would work though as of "right now" since it uses a different version of the REST api.

(this PR is still needed since ephemeral ids would also not work with 2.0.39)

@neilcsmith-net
Copy link
Member

Added a PR to update to use the v3 REST API. The legacy v2 API seems to be unstable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Java Platform Manager isn't working on Apple M2 MacOS Sequoia

4 participants