| | |
| | | import org.forgerock.opendj.ldap.AbstractAsynchronousConnection; |
| | | import org.forgerock.opendj.ldap.ConnectionEventListener; |
| | | import org.forgerock.opendj.ldap.Connections; |
| | | import org.forgerock.opendj.ldap.ErrorResultException; |
| | | import org.forgerock.opendj.ldap.LdapException; |
| | | import org.forgerock.opendj.ldap.FutureResult; |
| | | import org.forgerock.opendj.ldap.IntermediateResponseHandler; |
| | | import org.forgerock.opendj.ldap.LDAPOptions; |
| | |
| | | import org.glassfish.grizzly.ssl.SSLEngineConfigurator; |
| | | import org.glassfish.grizzly.ssl.SSLFilter; |
| | | |
| | | import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult; |
| | | import static org.forgerock.opendj.ldap.LdapException.newErrorResult; |
| | | import static org.forgerock.opendj.ldap.FutureResultWrapper.*; |
| | | |
| | | import static com.forgerock.opendj.grizzly.GrizzlyMessages.*; |
| | |
| | | */ |
| | | checkBindOrStartTLSInProgress(); |
| | | } |
| | | } catch (final ErrorResultException e) { |
| | | } catch (final LdapException e) { |
| | | return newFailedFutureResult(e); |
| | | } |
| | | |
| | |
| | | pendingRequests.remove(messageID); |
| | | throw adaptRequestIOException(e); |
| | | } |
| | | } catch (final ErrorResultException e) { |
| | | } catch (final LdapException e) { |
| | | future.adaptErrorResult(e.getResult()); |
| | | } |
| | | return future; |
| | |
| | | // FIXME: Is this the best result code? |
| | | final Result errorResult = Responses.newResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR) |
| | | .setDiagnosticMessage("An error occurred while creating a bind context").setCause(e); |
| | | final ErrorResultException error = ErrorResultException.newErrorResult(errorResult); |
| | | final LdapException error = LdapException.newErrorResult(errorResult); |
| | | |
| | | return newFailedFutureResult(error, messageID); |
| | | } |
| | |
| | | bindOrStartTLSInProgress.set(false); |
| | | throw adaptRequestIOException(e); |
| | | } |
| | | } catch (final ErrorResultException e) { |
| | | } catch (final LdapException e) { |
| | | future.adaptErrorResult(e.getResult()); |
| | | } |
| | | |
| | |
| | | pendingRequests.remove(messageID); |
| | | throw adaptRequestIOException(e); |
| | | } |
| | | } catch (final ErrorResultException e) { |
| | | } catch (final LdapException e) { |
| | | future.adaptErrorResult(e.getResult()); |
| | | } |
| | | return future; |
| | |
| | | pendingRequests.remove(messageID); |
| | | throw adaptRequestIOException(e); |
| | | } |
| | | } catch (final ErrorResultException e) { |
| | | } catch (final LdapException e) { |
| | | future.adaptErrorResult(e.getResult()); |
| | | } |
| | | return future; |
| | |
| | | bindOrStartTLSInProgress.set(false); |
| | | throw adaptRequestIOException(e); |
| | | } |
| | | } catch (final ErrorResultException e) { |
| | | } catch (final LdapException e) { |
| | | future.adaptErrorResult(e.getResult()); |
| | | } |
| | | return future; |
| | |
| | | pendingRequests.remove(messageID); |
| | | throw adaptRequestIOException(e); |
| | | } |
| | | } catch (final ErrorResultException e) { |
| | | } catch (final LdapException e) { |
| | | future.adaptErrorResult(e.getResult()); |
| | | } |
| | | return future; |
| | |
| | | pendingRequests.remove(messageID); |
| | | throw adaptRequestIOException(e); |
| | | } |
| | | } catch (final ErrorResultException e) { |
| | | } catch (final LdapException e) { |
| | | future.adaptErrorResult(e.getResult()); |
| | | } |
| | | return future; |
| | |
| | | pendingRequests.remove(messageID); |
| | | throw adaptRequestIOException(e); |
| | | } |
| | | } catch (final ErrorResultException e) { |
| | | } catch (final LdapException e) { |
| | | future.adaptErrorResult(e.getResult()); |
| | | } |
| | | return future; |
| | |
| | | } |
| | | } |
| | | |
| | | int continuePendingBindRequest(final LDAPBindFutureResultImpl future) |
| | | throws ErrorResultException { |
| | | int continuePendingBindRequest(final LDAPBindFutureResultImpl future) throws LdapException { |
| | | final int newMsgID = nextMsgID.getAndIncrement(); |
| | | synchronized (stateLock) { |
| | | checkConnectionIsValid(); |
| | |
| | | } |
| | | } |
| | | |
| | | private ErrorResultException adaptRequestIOException(final IOException e) { |
| | | private LdapException adaptRequestIOException(final IOException e) { |
| | | // FIXME: what other sort of IOExceptions can be thrown? |
| | | // FIXME: Is this the best result code? |
| | | final Result errorResult = Responses.newResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e); |
| | |
| | | return newErrorResult(errorResult); |
| | | } |
| | | |
| | | private void checkBindOrStartTLSInProgress() throws ErrorResultException { |
| | | private void checkBindOrStartTLSInProgress() throws LdapException { |
| | | if (bindOrStartTLSInProgress.get()) { |
| | | throw newErrorResult(ResultCode.OPERATIONS_ERROR, "Bind or Start TLS operation in progress"); |
| | | } |
| | | } |
| | | |
| | | private void checkConnectionIsValid() throws ErrorResultException { |
| | | private void checkConnectionIsValid() throws LdapException { |
| | | if (!isValid0()) { |
| | | if (failedDueToDisconnect) { |
| | | /* |