-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting IndexOutOfBoundsException when requesting JDK 8 #10
Comments
Works for me. Maybe there's a proxy hiding the foojay service or something in your environment. What do you see if you visit https://api.foojay.io/disco/v3.0 on the command line and in browser? |
@helpermethod yes, could you check your proxy? The error is from following code, and almost json data problem caused by proxy. String queryUrl = "https://api.foojay.io/disco/v3.0/packages?"
+ "distribution=" + vendor
+ "&version=" + version
+ "&operating_system=" + os
+ "&architecture=" + archName
+ "&bitness=" + bitness
+ "&archive_type=" + archiveType
+ "&libc_type=" + libcType
+ "&latest=overall&package_type=jdk&discovery_scope_id=directly_downloadable&match=any&javafx_bundled=false&directly_downloadable=true&release_status=ga";
HttpGet request = new HttpGet(queryUrl);
final HttpResponse response = httpClient.execute(request);
if (response.getStatusLine().getStatusCode() == 200) {
Gson gson = new Gson();
final JsonObject jsonObject = gson.fromJson(EntityUtils.toString(response.getEntity()), JsonElement.class).getAsJsonObject();
final JsonObject pkgJson = jsonObject.getAsJsonArray("result").get(0).getAsJsonObject();
String pkgInfoUri = pkgJson.getAsJsonObject("links").get("pkg_info_uri").getAsString();
HttpGet pkgInfoGet = new HttpGet(pkgInfoUri);
final HttpResponse pkgInfoResponse = httpClient.execute(pkgInfoGet);
if (pkgInfoResponse.getStatusLine().getStatusCode() == 200) {
final JsonObject pkgInfoJson = gson.fromJson(EntityUtils.toString(pkgInfoResponse.getEntity()), JsonElement.class).getAsJsonObject();
String downloadUrl = pkgInfoJson.getAsJsonArray("result").get(0).getAsJsonObject().get("direct_download_uri").getAsString();
return new String[]{pkgJson.get("filename").getAsString(), downloadUrl};
}
} I will take a look at the code and make good logging for error. |
Works fine for me: Browser: CLI: If I switch to Temurin it works too:
|
@dsyer @helpermethod a question here. Now the default vendor is String vendor = params.get("vendor");
if (vendor == null || vendor.isEmpty()) {
vendor = "oracle_open_jdk";
} |
I actually don't care about the vendor, as long as it works 😆. I wonder why I gut an IndexOutOfBoundsException. It may be related to my Arch/OS. I'll try to dig deeper. |
Hi!
With the following configuration I'm getting an
IndexOutOfBoundsException
. I suppose there is some problem with the download?The text was updated successfully, but these errors were encountered: