Skip to content

Java Libs Project requires Java 1.8, but uses packages introduced in Java 11 #1149

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

Closed
alecdesjardins opened this issue Dec 20, 2023 · 6 comments
Labels
lib/java Java client library

Comments

@alecdesjardins
Copy link

alecdesjardins commented Dec 20, 2023

Bug Report

Description

java.net.http was introduced to Java with 11, not 1.8. Therefore, the java libs project will not compile.

I tried this code:

./gradlew build

I expected to see this happen: build successfully

Instead, this happened: Webhook.java:3 error: package java.net.http does not exist import java.net.http.HttpHeaders;

@jameshiew
Copy link
Contributor

I'm able to import and use the library in a Java 8 project to interact with the Svix webhook service API in general, but can't use this Webhook class. This looks to be the only application code which is using Java 11+ features (e.g. java.net.http.HttpHeaders class).

public void verify(final String payload, final HttpHeaders headers) throws WebhookVerificationException {
Optional<String> msgId = headers.firstValue(SVIX_MSG_ID_KEY);
Optional<String> msgSignature = headers.firstValue(SVIX_MSG_SIGNATURE_KEY);
Optional<String> msgTimestamp = headers.firstValue(SVIX_MSG_TIMESTAMP_KEY);
if (msgId.isEmpty() || msgSignature.isEmpty() || msgTimestamp.isEmpty()) {
// fallback to unbranded
msgId = headers.firstValue(UNBRANDED_MSG_ID_KEY);
msgSignature = headers.firstValue(UNBRANDED_MSG_SIGNATURE_KEY);
msgTimestamp = headers.firstValue(UNBRANDED_MSG_TIMESTAMP_KEY);
if (msgId.isEmpty() || msgSignature.isEmpty() || msgTimestamp.isEmpty()) {
throw new WebhookVerificationException("Missing required headers");
}
}

Could potentially either bump the minimum supported Java version to 11, or update this class and tests to be Java 8 compatible - though unsure of what would be the best way to do that without affecting existing downstream users of the verify() method.

@tasn
Copy link
Member

tasn commented Apr 11, 2025

I believe this is now fixed?

@desjardinsalec
Copy link

@tasn who knows, I gave up on this project awhile ago.

@tasn
Copy link
Member

tasn commented Apr 12, 2025

@desjardinsalec, oh, sorry to hear, why? This PR or something else? We would love to get feedback.

@desjardinsalec
Copy link

@tasn Yeah inactivity from a valid issue, never a good sign.

@tasn
Copy link
Member

tasn commented Apr 13, 2025

Gotcha, sorry to hear about your experience. :(

We definitely messed up here by not addressing it earlier / communicating poorly, though I don't believe "inactivity from a valid issue" was a fair characterization of the issue.
Java 1.8 was long EOL when this ticket was opened (it's EOL since 2019), and Java 11 was out for 5 years at that point. This means this only didn't work for people using a deprecated version of Java. While it does suck for those still using this version, there were workarounds (not using the SDKs, upgrading your Java to a non-deprecated version etc.); so it's not like it was a major blocker for anyone, or if it was we weren't aware of it.

Sorry again for the trouble, and I really wish we had communicated better here.

@tasn tasn closed this as completed Apr 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib/java Java client library
Projects
None yet
Development

No branches or pull requests

5 participants