/**
  * Determines if the supplied response should result in an operation retry.
  *
  * @param request that produced the exception
  * @param ldapResponse provider response
  * @throws LdapException wrapping the ldap exception
  */
 protected void throwOperationException(final Request request, final LDAPResponse ldapResponse)
     throws LdapException {
   ProviderUtils.throwOperationException(
       config.getOperationExceptionResultCodes(),
       String.format("Ldap returned result code: %s", ldapResponse.getResultCode()),
       ldapResponse.getResultCode(),
       ldapResponse.getMatchedDN(),
       config.getControlProcessor().processResponseControls(ldapResponse.getControls()),
       ldapResponse.getReferrals(),
       false);
 }
 /**
  * Creates an operation response with the supplied response data.
  *
  * @param  <T> type of response
  * @param request containing controls
  * @param result of the operation
  * @param ldapResponse provider response
  * @return operation response
  */
 protected <T> Response<T> createResponse(
     final Request request, final T result, final LDAPResponse ldapResponse) {
   return new Response<T>(
       result,
       ResultCode.valueOf(ldapResponse.getResultCode()),
       ldapResponse.getErrorMessage(),
       ldapResponse.getMatchedDN(),
       config.getControlProcessor().processResponseControls(ldapResponse.getControls()),
       ldapResponse.getReferrals(),
       ldapResponse.getMessageID());
 }
 /** {@inheritDoc} */
 @Override
 public Response<Boolean> compare(final CompareRequest request) throws LdapException {
   Response<Boolean> response = null;
   try {
     final JLdapUtils bu = new JLdapUtils();
     final LDAPResponseQueue queue =
         connection.compare(
             request.getDn(),
             bu.fromLdapAttribute(request.getAttribute()),
             (LDAPResponseQueue) null,
             getLDAPConstraints(request));
     final LDAPResponse lr = (LDAPResponse) queue.getResponse();
     response = createResponse(request, lr.getResultCode() == ResultCode.COMPARE_TRUE.value(), lr);
   } catch (LDAPException e) {
     processLDAPException(e);
   }
   return response;
 }