Bonjour,
Mon problème est résolu !
En réalité des caractères incompatible avec la norme XML provoquaient ces erreurs !
Voici le code me permettant de créer mon hashmap avec les vérifications :
import org.bonitasoft.connectors.ldap.LdapAttribute;
import java.text.AttributedCharacterIterator.Attribute;
import java.util.HashMap;
import java.util.Map;
//res_hashmap is the dictionnary returned
HashMap<String, HashMap<String, String>> res_hashmap = new HashMap<String, HashMap<String, String>>();
//Creating working variables
String temp_value = new String()
String temp_name = new String()
// Creating patterns (regexp based) matching illegal xml caracters (XML1.0 & XML1.1)
String xml10pattern = “[^” + “\u0009\r\n” + “\u0020-\uD7FF” + “\uE000-\uFFFD” + “\ud800\udc00-\udbff\udfff” + “]”;
String xml11pattern = “[^” + “\u0001-\uD7FF” + “\uE000-\uFFFD” + “\ud800\udc00-\udbff\udfff” + “]+”;
for (user in ldapAttributeList){
//Creating temp_hashmap for storing the users attribute
HashMap<String, String> temp_hashmap = new HashMap<String, String>();
for (attr in user){
if (attr.getValue() != null & attr.getName() != null & attr != null){
//Converting value of attribute in UTF8
try{
temp_value = attr.getValue().replaceAll(xml10pattern, "").replaceAll(xml11pattern, "")
temp_value = new String(temp_value.getBytes("UTF8"), "UTF8");
}
catch (UnsupportedEncodingException e) {
temp_value = e.printStackTrace();
}
//Converting name of attribute in UTF8
try{
temp_name = attr.getName().replaceAll(xml10pattern, "").replaceAll(xml11pattern, "")
temp_name = new String(temp_name.getBytes("UTF8"), "UTF8");
}
catch (UnsupportedEncodingException e) {
temp_name = e.printStackTrace();
}
}
//Storing them into the temp_hashmap
temp_hashmap.put(temp_name, temp_value)
}
//Adding user attrs hasmap to the hashmap of user attrs
res_hashmap.put(temp_hashmap["cn"], temp_hashmap);
}
return new HashMap<String, HashMap<String, String>>(res_hashmap)
En espérant que ça en aide certains dans l’avenir !