RFR: 8223260: NamingManager should cache InitialContextFactory

Alan Bateman Alan.Bateman at oracle.com
Fri Feb 7 10:45:03 UTC 2020

On 07/02/2020 10:36, Peter Levart wrote:
> :
> Well, theoretically, some implementation of InitialContextFactory 
> could, in its constructor, use a not well-behaved dynamic Proxy which 
> could throw UndeclaredThrowableException with 
> NoInitialContextException as a cause and such exception would get 
> unwrapped later in NamingManager.getInitialContext() where it would 
> mistakenly be identified as an exception constructed in 
> NamingManager.getFactory method. Using your own sub-type of 
> RuntimeException for tunneling the NoInitialContextException through 
> the functional interface (lambda) would eliminate even this remote 
> possibility. 
The concern is more that UndeclaredThrowableException is specified for 
handling exceptions on proxy interfaces. The question in one of the 
replies was whether there is a more appropriate exception to carry the 
checked exception. A static nested exception class would be fine.


More information about the core-libs-dev mailing list