Skip to content
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

CleanerJava9 should be able to do its job even with a SecurityManager… #8204

Merged
merged 1 commit into from
Aug 28, 2018

Conversation

normanmaurer
Copy link
Member

… installed.

Motivation:

CleanerJava9 currently fails whever a SecurityManager is installed. We should make use of AccessController.doPrivileged(...) so the user can give it the correct rights.

Modifications:

Use doPrivileged(...) when needed.

Result:

Fixes #8201.

… installed.

Motivation:

CleanerJava9 currently fails whever a SecurityManager is installed. We should make use of AccessController.doPrivileged(...) so the user can give it the correct rights.

Modifications:

Use doPrivileged(...) when needed.

Result:

Fixes #8201.
@normanmaurer
Copy link
Member Author

@jprante PTAL as well

@johnou
Copy link
Contributor

johnou commented Aug 20, 2018

@normanmaurer handles out of scope?

@normanmaurer
Copy link
Member Author

@johnou there is a lot other things to fix that also can use handles so I think I would do this as a follow up with a much bigger scope

}

private static void freeDirectBufferPrivileged(final ByteBuffer buffer) {
Exception error = AccessController.doPrivileged(new PrivilegedAction<Exception>() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idle question: why not use PrivilegedExceptionAction ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is not much advantage here.. We will need to unwrap then etc.

Copy link
Member

@carl-mastrangelo carl-mastrangelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

} catch (InvocationTargetException e) {
return e;
} catch (IllegalAccessException e) {
return e;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could just catch a Throwable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also honestly I think it will not make any difference. So maybe just keep it ?

@normanmaurer normanmaurer merged commit 8679c5e into 4.1 Aug 28, 2018
@normanmaurer normanmaurer deleted the cleaner9_security_manager branch August 28, 2018 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants