From 1f2f46fa65db97b476f588e9f92d19d447b1b6ea Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 26 Sep 2013 08:44:30 +0000
Subject: [PATCH] Minor code cleanup for OPENDJ-672: LDAP SDK SSL connect attempts fail with horrible stack trace when handshake fails
---
opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnection.java | 26 ++++++++++++++------------
1 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnection.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnection.java
index dff0a0a..43f1bd0 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnection.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPConnection.java
@@ -623,20 +623,22 @@
}
}
- // Now try cleanly closing the connection if possible.
- // Only send unbind if specified.
+ /*
+ * Now try cleanly closing the connection if possible. Only send unbind
+ * if specified.
+ */
if (unbindRequest != null) {
+ final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
try {
- final ASN1BufferWriter asn1Writer = ASN1BufferWriter.getWriter();
- try {
- ldapWriter
- .unbindRequest(asn1Writer, nextMsgID.getAndIncrement(), unbindRequest);
- connection.write(asn1Writer.getBuffer(), null);
- } finally {
- asn1Writer.recycle();
- }
- } catch (final IOException e) {
- // Underlying channel prob blown up. Just ignore.
+ ldapWriter.unbindRequest(asn1Writer, nextMsgID.getAndIncrement(), unbindRequest);
+ connection.write(asn1Writer.getBuffer(), null);
+ } catch (final Exception ignore) {
+ /*
+ * Underlying channel probably blown up. Ignore all errors,
+ * including possibly runtime exceptions (see OPENDJ-672).
+ */
+ } finally {
+ asn1Writer.recycle();
}
}
factory.getTimeoutChecker().removeConnection(this);
--
Gitblit v1.10.0