code: private void getDACL() throws NamingException {
          final SearchControls controls = new SearchControls();
          controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
          controls.setReturningAttributes(new String[] { "name", "nTSecurityDescriptor" });
  
          if (ldapContext == null) {
              LOG.warn("getDACL, cannot search for DACL with null ldapContext");
              throw new CommunicationException("NULL ldapContext");
          }
  
          ldapContext.setRequestControls(new Control[] { new SDFlagsControl(0x00000004) });
  
          LOG.debug("getDACL, attempting to fetch SD for searchFilter: {}, ldapContext: {}", searchFilter,
                  ldapContext.getNameInNamespace());
          NamingEnumeration<SearchResult> results = null;
          try {
              results = ldapContext.search("", searchFilter, controls);
              if (!results.hasMoreElements()) {
                  LOG.warn("getDACL, searchFilter '{}' found nothing in context '{}'", searchFilter,
                          ldapContext.getNameInNamespace());
                  throw new NameNotFoundException("No results found for: " + searchFilter);
              }
  
              SearchResult res = results.next();
              if (results.hasMoreElements()) {
                  // result from search filter is not unique
                  throw new SizeLimitExceededException("The search filter '{}' matched more than one AD object");
              }
              final byte[] descbytes = (byte[]) res.getAttributes().get("nTSecurityDescriptor").get();
              final SDDL sddl = new SDDL(descbytes);
              dacl = sddl.getDacl();
              LOG.debug("getDACL, fetched SD & parsed DACL for searchFilter: {}, ldapContext: {}", searchFilter,
                      ldapContext.getNameInNamespace());
          } finally {
              try {
                  if (results != null) {
                      results.close();
                  }
              } catch (NamingException e) {
                  LOG.debug("NamingException occurred while closing results: ", e);
              }
          }
      }
docs: Fetches the DACL of the object which is evaluated by {@linkplain doAssert}
  
  @throws CommunicationException
  @throws NameNotFoundException
  @throws NamingException