LDAP相关操作注意事项

 lc.Modify(entry.DN, new LdapModification(LdapModification.REPLACE, new LdapAttribute("mDBUseDefaults", "FALSE")));//必须大写

对于布尔类型的属性值,必须要大写,否则报错;

 if (entry.getAttribute("mDBStorageQuota") != null)
                                        lc.Modify(entry.DN, new LdapModification(LdapModification.DELETE, new LdapAttribute("mDBStorageQuota")));

在执行删除操作的时候,必须要先判断有无该属性,否则执行失败;

 lc.Modify(entry.DN, new LdapModification(LdapModification.REPLACE,
                                        new LdapAttribute("mDBStorageQuota","");//ERROR

执行更新操作,需要注意的是,更新的值必须不能为空,否则报错。也就是说,要是清空某一个属性值,只能是执行DELETE删除该属性;

posted @ 2017-09-17 16:15  lishidefengchen  阅读(353)  评论(0编辑  收藏  举报