/** * Retrieves the list of controls for this LDAP response, if any. * * @return The list of controls for this LDAP response, or {@code null} if * there are none. */ public LDAPControl[] getControls() { final Control[] controls = ldapResult.getResponseControls(); if (controls.length == 0) { return null; } return LDAPControl.toLDAPControls(controls); }
/** * Ensures that the provided LDAP result does not include any control with * the specified OID. * * @param result The LDAP result to examine. * @param oid The OID of the control which is not expected to be present * in the result. * * @throws AssertionError If the provided LDAP result includes any control * with the specified OID. */ public static void assertMissingControl(final LDAPResult result, final String oid) throws AssertionError { for (final Control c : result.getResponseControls()) { if (c.getOID().equals(oid)) { throw new AssertionError(ERR_TEST_RESULT_HAS_CONTROL.get( String.valueOf(result), oid)); } } }
/** * Ensures that the provided LDAP result includes at least one control with * the specified OID. * * @param result The LDAP result to examine. * @param oid The OID of the control which is expected to be present in * the result. * * @return The first control found with the specified OID. * * @throws AssertionError If the provided LDAP result does not include any * control with the specified OID. */ public static Control assertHasControl(final LDAPResult result, final String oid) throws AssertionError { for (final Control c : result.getResponseControls()) { if (c.getOID().equals(oid)) { return c; } } throw new AssertionError(ERR_TEST_RESULT_MISSING_CONTROL.get( String.valueOf(result), oid)); }
/** * Sets the response controls for this connection. * * @param ldapResult The result containing the controls to use. */ private void setResponseControls(final LDAPResult ldapResult) { if (ldapResult.hasResponseControl()) { responseControls = LDAPControl.toLDAPControls(ldapResult.getResponseControls()); } else { responseControls = null; } }
throws LDAPException final Control[] controls = result.getResponseControls(); final ArrayList<AssuredReplicationResponseControl> decodedControls = new ArrayList<AssuredReplicationResponseControl>(controls.length);
/** * Creates a new get changelog batch extended result with only the generic * LDAP result information and no extended value. * * @param r An LDAP result with general details of the response. It must * not be {@code null}. */ public GetChangelogBatchExtendedResult(final LDAPResult r) { super(r.getMessageID(), r.getResultCode(), r.getDiagnosticMessage(), r.getMatchedDN(), r.getReferralURLs(), null, null, r.getResponseControls()); resumeToken = null; changesAlreadyPurged = false; moreChangesAvailable = false; estimatedChangesRemaining = -1; entryCount = -1; entryList = null; additionalInfo = null; }
/** * Creates a new search result object with the provided message ID and with * the protocol op and controls read from the given ASN.1 stream reader. * * @param messageID The LDAP message ID for the LDAP message that is * associated with this LDAP result. * @param messageSequence The ASN.1 stream reader sequence used in the * course of reading the LDAP message elements. * @param reader The ASN.1 stream reader from which to read the * protocol op and controls. * * @return The decoded search result object. * * @throws LDAPException If a problem occurs while reading or decoding data * from the ASN.1 stream reader. */ static SearchResult readSearchResultFrom(final int messageID, final ASN1StreamReaderSequence messageSequence, final ASN1StreamReader reader) throws LDAPException { final LDAPResult r = LDAPResult.readLDAPResultFrom(messageID, messageSequence, reader); return new SearchResult(messageID, r.getResultCode(), r.getDiagnosticMessage(), r.getMatchedDN(), r.getReferralURLs(), -1, -1, r.getResponseControls()); }
/** * Creates a new search result object with the provided message ID and with * the protocol op and controls read from the given ASN.1 stream reader. * * @param messageID The LDAP message ID for the LDAP message that is * associated with this LDAP result. * @param messageSequence The ASN.1 stream reader sequence used in the * course of reading the LDAP message elements. * @param reader The ASN.1 stream reader from which to read the * protocol op and controls. * * @return The decoded search result object. * * @throws LDAPException If a problem occurs while reading or decoding data * from the ASN.1 stream reader. */ static SearchResult readSearchResultFrom(final int messageID, final ASN1StreamReaderSequence messageSequence, final ASN1StreamReader reader) throws LDAPException { final LDAPResult r = LDAPResult.readLDAPResultFrom(messageID, messageSequence, reader); return new SearchResult(messageID, r.getResultCode(), r.getDiagnosticMessage(), r.getMatchedDN(), r.getReferralURLs(), -1, -1, r.getResponseControls()); }
Arrays.asList(deleteResult.getResponseControls()));
/** * Creates a new LDAP exception using the information contained in the * provided LDAP result object. * * @param ldapResult The LDAP result object containing the information to * use for this LDAP exception. */ public LDAPException(final LDAPResult ldapResult) { super((ldapResult.getDiagnosticMessage() == null) ? ldapResult.getResultCode().getName() : ldapResult.getDiagnosticMessage()); resultCode = ldapResult.getResultCode(); matchedDN = ldapResult.getMatchedDN(); diagnosticMessage = ldapResult.getDiagnosticMessage(); referralURLs = ldapResult.getReferralURLs(); responseControls = ldapResult.getResponseControls(); }
/** * Creates a new LDAP exception using the information contained in the * provided LDAP result object. * * @param ldapResult The LDAP result object containing the information to * use for this LDAP exception. * @param cause The underlying exception that triggered this exception. */ public LDAPException(final LDAPResult ldapResult, final Throwable cause) { super(((ldapResult.getDiagnosticMessage() == null) ? ldapResult.getResultCode().getName() : ldapResult.getDiagnosticMessage()), cause); resultCode = ldapResult.getResultCode(); matchedDN = ldapResult.getMatchedDN(); diagnosticMessage = ldapResult.getDiagnosticMessage(); referralURLs = ldapResult.getReferralURLs(); responseControls = ldapResult.getResponseControls(); }
Arrays.asList(modifyResult.getResponseControls()));
Arrays.asList(addResult.getResponseControls()));
/** * Creates a new LDAP exception using the information contained in the * provided LDAP result object. * * @param ldapResult The LDAP result object containing the information to * use for this LDAP exception. */ public LDAPException(final LDAPResult ldapResult) { super((ldapResult.getDiagnosticMessage() == null) ? ldapResult.getResultCode().getName() : ldapResult.getDiagnosticMessage()); resultCode = ldapResult.getResultCode(); matchedDN = ldapResult.getMatchedDN(); diagnosticMessage = ldapResult.getDiagnosticMessage(); referralURLs = ldapResult.getReferralURLs(); responseControls = ldapResult.getResponseControls(); }
/** * Creates a new LDAP exception using the information contained in the * provided LDAP result object. * * @param ldapResult The LDAP result object containing the information to * use for this LDAP exception. * @param cause The underlying exception that triggered this exception. */ public LDAPException(final LDAPResult ldapResult, final Throwable cause) { super(((ldapResult.getDiagnosticMessage() == null) ? ldapResult.getResultCode().getName() : ldapResult.getDiagnosticMessage()), cause); resultCode = ldapResult.getResultCode(); matchedDN = ldapResult.getMatchedDN(); diagnosticMessage = ldapResult.getDiagnosticMessage(); referralURLs = ldapResult.getReferralURLs(); responseControls = ldapResult.getResponseControls(); }
Arrays.asList(searchResult.getResponseControls()));
Arrays.asList(bindResult.getResponseControls()));
Arrays.asList(modifyDNResult.getResponseControls()));
Arrays.asList(compareResult.getResponseControls()));
handleControls(result.getResponseControls());