{"record":{"id":"a2230cd10f899e9c","repo":"elastic/elasticsearch","slug":"unknown-jdk-vendor-vendor","errorCode":null,"errorMessage":"Unknown JDK vendor [${vendor}]","messagePattern":"Unknown JDK vendor \\[(.+?)\\]","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/JdkDownloadPlugin.java","lineNumber":164,"sourceCode":"                        + jdk.getMajor()\n                        + \"/\"\n                        + jdk.getBuild()\n                        + \"/GPL/openjdk-[revision]_[module]-[classifier]_bin.[ext]\";\n                }\n            }\n        } else if (jdk.getVendor().equals(VENDOR_ZULU)) {\n            repoUrl = \"https://cdn.azul.com\";\n            if (jdk.getMajor().equals(\"8\") && isJdkOnMacOsPlatform(jdk) && jdk.getArchitecture().equals(\"aarch64\")) {\n                artifactPattern = \"zulu/bin/zulu\"\n                    + jdk.getDistributionVersion()\n                    + \"-ca-jdk\"\n                    + jdk.getBaseVersion().replace(\"u\", \".0.\")\n                    + \"-[module]x_[classifier].[ext]\";\n            } else {\n                throw new GradleException(\"JDK vendor zulu is supported only for JDK8 on MacOS with Apple Silicon.\");\n            }\n        } else {\n            throw new GradleException(\"Unknown JDK vendor [\" + jdk.getVendor() + \"]\");\n        }\n\n        // Define the repository if we haven't already\n        if (repositories.findByName(repoName) == null) {\n            repositories.ivy(repo -> {\n                repo.setName(repoName);\n                repo.setUrl(repoUrl);\n                repo.metadataSources(IvyArtifactRepository.MetadataSources::artifact);\n                repo.patternLayout(layout -> layout.artifact(artifactPattern));\n                repo.content(repositoryContentDescriptor -> repositoryContentDescriptor.includeGroup(groupName(jdk)));\n            });\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public static NamedDomainObjectContainer<Jdk> getContainer(Project project) {\n        return (NamedDomainObjectContainer<Jdk>) project.getExtensions().getByName(EXTENSION_NAME);\n    }","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/JdkDownloadPlugin.java#L146-L182","documentation":"Thrown by JdkDownloadPlugin.setupRepository in the final else branch when jdk.getVendor() is neither 'adoptium', 'openjdk', nor 'zulu'. Because Jdk.setVendor already rejects any vendor outside ALLOWED_VENDORS (the same three values) at configuration time, this branch is a defensive duplicate that is effectively unreachable for Jdk instances created through the normal container — it guards against a future divergence between the allowlist and the plugin's if/else chain.","triggerScenarios":"setupRepository is reached with a Jdk whose vendor is not one of the three handled cases. Requires either bypassing Jdk.setVendor's validation or the allowlist and the if/else chain drifting out of sync.","commonSituations":"A future change that adds a vendor to ALLOWED_VENDORS in Jdk.java without adding a corresponding branch (and repository definition) in JdkDownloadPlugin.setupRepository; reflective/test construction that sets the Property without the setter's guard.","solutions":["Use only 'adoptium', 'openjdk', or 'zulu' as the vendor.","If you are extending build tooling to support a new vendor, add it to BOTH Jdk.ALLOWED_VENDORS and a new branch in JdkDownloadPlugin.setupRepository with a concrete repoUrl and artifactPattern — otherwise this defensive throw will fire."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Unreachable through normal Jdk construction because setVendor already\n// rejects non-allowlisted vendors. As a build-tooling author, keep\n// Jdk.ALLOWED_VENDORS and the if/else chain in JdkDownloadPlugin in sync:\nassert ALLOWED_VENDORS.equals(List.of(\"adoptium\", \"openjdk\", \"zulu\"));\n// every vendor in ALLOWED_VENDORS must have a branch in setupRepository.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When adding a vendor to Jdk.ALLOWED_VENDORS, immediately add a matching branch in JdkDownloadPlugin.setupRepository.","Add a test that iterates ALLOWED_VENDORS and asserts each has a repository definition.","Do not bypass Jdk.setVendor via the Property setter; always go through the validated setter."],"tags":["gradle","jdk","vendor","defensive","unreachable","build-config"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}