RFR 8073056: Repeating annotations throws java.security.AccessControlException with a SecurityManager
Paul Sandoz
paul.sandoz at oracle.com
Wed Feb 25 12:16:02 UTC 2015
On Feb 25, 2015, at 12:59 PM, Joel Borggrén-Franck <joel.franck at oracle.com> wrote:
> Hi Paul,
>
> Yes that would indeed be possible, but after some internal discussions we though it safer to reuse the Proxy invocation path.
>
Ok, i claim ignorance as to why that is so :-)
Is there any performance impact since all code will go through the proxy? It might be possible to check if the security manager is enabled before going through that path? If not I think you should add a comment on the effectively dead code path of direct method invocation.
213 } catch (IllegalAccessException | // couldn't loosen security
214 IllegalArgumentException | // parameters doesn't match
215 InvocationTargetException | // the value method threw an exception
216 ClassCastException e) {
217 throw invalidContainerException(container, e);
218 } catch (Throwable t) { // from InvocationHandler::invoke
219 throw invalidContainerException(container, t);
220 }
221 }
222
You could compress all this down to just catching Throwable. It seems quite a large net that may inadvertently catch other runtime exceptions.
Paul.
More information about the core-libs-dev
mailing list