Example usage for javax.naming SizeLimitExceededException getExplanation

List of usage examples for javax.naming SizeLimitExceededException getExplanation

Introduction

In this page you can find the example usage for javax.naming SizeLimitExceededException getExplanation.

Prototype

public String getExplanation() 

Source Link

Document

Retrieves the explanation associated with this exception.

Usage

From source file:org.nuxeo.ecm.directory.ldap.LDAPSession.java

protected DocumentModelList ldapResultsToDocumentModels(NamingEnumeration<SearchResult> results,
        boolean fetchReferences) throws DirectoryException, NamingException {
    DocumentModelListImpl list = new DocumentModelListImpl();
    try {/*from w w w.  ja  v  a2  s.com*/
        while (results.hasMore()) {
            SearchResult result = results.next();
            DocumentModel entry = ldapResultToDocumentModel(result, null, fetchReferences);
            if (entry != null) {
                list.add(entry);
            }
        }
    } catch (SizeLimitExceededException e) {
        if (list.isEmpty()) {
            // the server did no send back the truncated results set,
            // re-throw the exception to that the user interface can display
            // the error message
            throw e;
        }
        // mark the collect results as a truncated result list
        log.debug("SizeLimitExceededException caught," + " return truncated results. Original message: "
                + e.getMessage() + " explanation: " + e.getExplanation());
        list.setTotalSize(-2);
    } finally {
        results.close();
    }
    log.debug("LDAP search returned " + list.size() + " results");
    return list;
}