-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add backwards compatibility shim #13
Conversation
This should cover most use cases currently existing in the kbase use case other than a few that are easy to handle on upgrade, and one case in the User Profile service an unused method.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13 +/- ##
============================================
- Coverage 96.08% 92.60% -3.49%
- Complexity 88 107 +19
============================================
Files 5 7 +2
Lines 230 284 +54
Branches 44 48 +4
============================================
+ Hits 221 263 +42
- Misses 7 19 +12
Partials 2 2 ☔ View full report in Codecov by Sentry. |
import java.net.MalformedURLException; | ||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
import java.net.URL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
java.net.URL
was imported twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One is URI, one is URL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
try { | ||
return new URL(DEFAULT_KBASE_AUTH_SERVER_URL); | ||
} catch (MalformedURLException e) { | ||
throw new RuntimeException("The impossible just happened"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If impossible, why use try catch? It an exception could be raised, maybe a more descriptive exception message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I don't want to pollute the method signature with a checked exception that can never be thrown
I got confused with new URL() vs new URI() in java. Any insights are greatly appreciated! |
What are you confused about? |
Based on the code, one can easily converted to the other. Not sure why URI is needed. |
The new auth client takes a URI, so it's needed due to that. As to why it takes a URI vs. a URL, I just copied the Jersey client: https://javadoc.io/doc/org.glassfish.jersey.bundles/jaxrs-ri/2.29.1/javax/ws/rs/client/Client.html The backwards compatibility shim takes a URL because that's what the old client took |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This should cover most use cases currently existing in the kbase use case other than a few that are easy to handle on upgrade, and one case in the User Profile service an unused method.