-
Notifications
You must be signed in to change notification settings - Fork 239
[CALCITE-6590] Use reflection to handle Java SecurityManager deprecation in Avatica #251
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
Conversation
|
This is the alternate patch using reflection. |
5a76c1d to
1b50792
Compare
1b50792 to
b254987
Compare
|
Have you been able to check this @julianhyde ? |
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
|
The approach here is directly lifted from Jetty (pruning some unused functions) |
|
rebased on main |
chrisdennis
left a comment
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.
Since community review was requested I figured I'd cast an eye over this. The usage of SecurityUtils looks fine to me... the class itself has some issues for me though. Not sure how you want to approach that though, and obviously feel free to dismiss all of this if desired.
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
|
I realized my suggestions for |
rename sneaky update comments / javadoc
|
I have applied your PR, and made some minor changes. These are in different commits. |
chrisdennis
left a comment
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.
Looks good to me... you rightly point out that what we have makes some assumptions about the order of any future removals but I think they're reasonable assumptions.
zabetak
left a comment
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.
Few small comments and I think we are ready to merge this.
core/src/main/java/org/apache/calcite/avatica/util/SecurityUtils.java
Outdated
Show resolved
Hide resolved
|
I have changed the name back to sneakyThrow(). Since we're going for perfection, we may also want to reconsider callAs(). Subject callAs() throws Exceptions, and the fallback path now also throws exceptions (wrapped in PrivilegedActionException). We could change it to something like : |
Apologies for triggering some (all?) of this bike-shedding.
I'm confused, Subject.callAs(...) throws |
This reverts commit 8094ca4.
You are right. However, since Subject.callAs() explicitly throws CompletionException, shouldn't SecurityUtils.callAs() also explictly throw CompletionException ? |
Yes, that would make sense. |
|
This is as polished as it gets now. Can you do a final review @zabetak ? |
zabetak
left a comment
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.
The changes in the PR LGTM!
I also run ./gradlew build with JDK23 locally and it passed without problems so I guess we are good to merge this.
|
Merged manually. |
|
Thanks for getting this in @stoty, @chrisdennis and @zabetak! |
Also bump ByteBuddy version to 1.15.1