On Mon, 13 Jan 2025 13:56:54 GMT, Kevin Walls <kev...@openjdk.org> wrote:

> This is a post-SecurityManager-removal cleanup, following-on from:
> 
> 8344394: Remove SecurityManager and related calls from java.management.rmi 
> 
> 
> Remove mention of "privilege" in Exception handling in RMIConnectionImpl.
> Remove wrapping of Exceptions in PrivilegedActionException.
> 
> The methods that invoke an operation handle expected Exceptions, but also 
> need to handle SecurityException and RuntimeException, to avoid their default 
> case of wrapping an Exception in an IOException to signal a problem.

Changes requested by dfuchs (Reviewer).

src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
 line 212:

> 210:                 throw (SecurityException) e;
> 211:             if (e instanceof RuntimeException)
> 212:                 throw (RuntimeException) e;

Throughout all these changes: SecurityException is  a RuntimeException, so you 
do not need to check for both.

An alternative is to:

} catch (RuntimeException r) {
    throw r;
} catch (Exception e) {
    ....
}

-------------

PR Review: https://git.openjdk.org/jdk/pull/23072#pullrequestreview-2559138986
PR Review Comment: https://git.openjdk.org/jdk/pull/23072#discussion_r1920262189

Reply via email to