RFR: 8273402: Use derived NamingExceptions in com.sun.jndi.ldap.Connection#readReply

Daniel Fuchs dfuchs at openjdk.java.net
Fri Sep 10 09:06:04 UTC 2021


On Thu, 9 Sep 2021 22:02:55 GMT, Aleksei Efimov <aefimov at openjdk.org> wrote:

> Hi,
> The following fix changes type of exception thrown when an LDAP operation fails for reasons like read timeout or connection closure/cancellation: instead of throwing a general `NamingException`, the internal LDAP connection class will throw a [`CommunicationException`](https://github.com/openjdk/jdk/blob/master/src/java.naming/share/classes/javax/naming/CommunicationException.java#L29) that better matches the reasons described.
> 
> Testing shows no problem with the proposed fix.

Thanks Aleksei. Using an IOException as the cause of CommunicationException, rather than a plain NamingException, to convey exceptional cases like "connection closed" seems to be the right choice to me.

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

Marked as reviewed by dfuchs (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/5456


More information about the core-libs-dev mailing list