log.logInfo("getAttributes: Truststore is " + System.getProperty("javax.net.ssl.trustStore"));
    private HashMap getAttributes(final InitialLdapContext ldap, final String rdn, final String[] attributes)    throws BackendException {        // Sanity checks.        if (ldap == null)            throw new NullPointerException("LDAP context cannot be NULL");        if (rdn == null)            throw new NullPointerException("RDN cannot be NULL");        if ((attributes == null) || (attributes.length == 0))            return new HashMap();        // The context provider URL, for later logging.        String url = "unknown backend";        // Get the attributes from an already initialized LDAP connection.        Attributes oldAttrs = null;        try {            // Remember the URL, for later logging.            url = (String) ldap.getEnvironment().get(Context.PROVIDER_URL);            // Get the attributes.            oldAttrs = ldap.getAttributes(rdn, attributes);        } catch (NamingException e) {            throw new BackendException("Unable to read attributes '" + attributes + "' from '" + url + "'", e);        }        // Translate retrieved attributes from Attributes to HashMap.        HashMap newAttrs = new HashMap();        for (int i = 0; i < attributes.length; i++) {            // Did we get an attribute back at all?            Attribute oldAttr = oldAttrs.get(attributes[i]);            if (oldAttr == null) {                log.logInfo("Requested attribute '" + attributes[i] + "' not found on '" + url + "'", mySessionTicket);            } else {                // Map the attribute values to String[].                ArrayList newValues = new ArrayList(oldAttr.size());                for (int j = 0; j < oldAttr.size(); j++) {                    try {                                                // We either have a String or a byte[].                        String newValue = null;                        try {                            newValue = new String(((String) oldAttr.get(j)).getBytes(), DirectoryManagerBackend.ATTRIBUTE_VALUE_CHARSET);                        } catch (ClassCastException e) {                                                        // Map byte[] to String, using ISO-8859-1 encoding.                            newValue = new String((byte[]) oldAttr.get(j), DirectoryManagerBackend.ATTRIBUTE_VALUE_CHARSET);                                                    }                        newValues.add(newValue);                                            } catch (NamingException e) {                        throw new BackendException("Unable to read attribute value of '" + oldAttr.getID() + "' from '" + url + "'", e);                    } catch (UnsupportedEncodingException e) {                        throw new BackendException("Unable to use ISO-8859-1 encoding", e);                    }                }                newAttrs.put(attributes[i], (String[]) newValues.toArray(new String[] {}));            }        }        return newAttrs;    }