Exemplo n.º 1
0
 /**
  * Determines whether the supplied ldap exception should be ignored.
  *
  * @param ignoreResultCodes to match against the exception
  * @param e ldap exception to match
  * @return result code that should be ignored or null
  */
 protected ResultCode ignoreSearchException(
     final ResultCode[] ignoreResultCodes, final LDAPException e) {
   ResultCode ignore = null;
   if (ignoreResultCodes != null && ignoreResultCodes.length > 0) {
     for (ResultCode rc : ignoreResultCodes) {
       if (e.getResultCode() == rc.value()) {
         logger.debug("Ignoring ldap exception", e);
         ignore = rc;
         break;
       }
     }
   }
   return ignore;
 }
 /** {@inheritDoc} */
 @Override
 public void handle(final DERParser parser, final ByteBuffer encoded) {
   final int resultValue = IntegerType.decode(encoded).intValue();
   final ResultCode rc = ResultCode.valueOf(resultValue);
   if (rc == null) {
     throw new IllegalArgumentException("Unknown result code " + resultValue);
   }
   getObject().setSortResult(rc);
 }
Exemplo n.º 3
0
 /**
  * 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());
 }
Exemplo n.º 4
0
 /** {@inheritDoc} */
 @Override
 public void close(final RequestControl[] controls) throws LdapException {
   try {
     if (connection != null) {
       connection.disconnect(getLDAPConstraints(controls));
     }
   } catch (LDAPException e) {
     throw new LdapException(e, ResultCode.valueOf(e.getResultCode()));
   } finally {
     connection = null;
   }
 }