@Test public void escapeUserGroupNames() { assertNull(LdapUtils.escapeCommonName(null)); assertEquals("", LdapUtils.escapeCommonName("")); assertEquals("\\,", LdapUtils.escapeCommonName(",")); assertEquals("\\,\\=\\+\\<\\>\\#\\;\\\\\\\"", LdapUtils.escapeCommonName(",=+<>#;\\\"")); }
public static String escapeCommonName(final String name) { if (name == null) { return null; } final StringBuilder buf = new StringBuilder(name.length() + 5); for (int i = 0; i < name.length(); i++) { final char ch = name.charAt(i); if (",=+<>#;\\\"".indexOf(ch) >= 0) { buf.append("\\"); } buf.append(ch); } return buf.toString(); }
LdapUtils { public static String escapeCommonName(final String name) { if (name == null) { return null; } final StringBuilder buf = new StringBuilder(name.length() + 5); for (int i = 0; i < name.length(); i++) { final char ch = name.charAt(i); if (",=+<>#;\\\"".indexOf(ch) >= 0) { buf.append("\\"); } buf.append(ch); } return buf.toString(); } }
LdapUtils { public static String escapeCommonName(final String name) { if (name == null) { return null; } final StringBuilder buf = new StringBuilder(name.length() + 5); for (int i = 0; i < name.length(); i++) { final char ch = name.charAt(i); if (",=+<>#;\\\"".indexOf(ch) >= 0) { buf.append("\\"); } buf.append(ch); } return buf.toString(); }  }
LdapUtils { public static String escapeCommonName(final String name) { if (name == null) { return null; } final StringBuilder buf = new StringBuilder(name.length() + 5); for (int i = 0; i < name.length(); i++) { final char ch = name.charAt(i); if (",=+<>#;\\\"".indexOf(ch) >= 0) { buf.append("\\"); } buf.append(ch); } return buf.toString(); }  static String escapeCommonName(final String name); static String getOu(final String... organizationalUnits); static String getOu(final String ou, final String[] organizationalUnits); static void buildOu(final StringBuffer buf, final String ou, final String[] organizationalUnits); static void buildOu(final StringBuffer buf, final String... organizationalUnits); static void appendOu(final StringBuffer buf, final String... organizationalUnits); static String getOrganizationalUnit(final String dn); static String getOrganizationalUnit(final String dn, final String ouBase); static Object getAttributeValue(final Attributes attributes, final String attrId); static String getAttributeStringValue(final Attributes attributes, final String attrId); static String[] getAttributeStringValues(final Attributes attributes, final String attrId); static Integer getAttributeIntegerValue(final Attributes attributes, final String attrId); static Attribute putAttribute(final Attributes attributes, final String attrId, final String attrValue); static String splitMultipleAttribute(final String attrId, final String value); static List<String> getMissedObjectClasses(final String[] expectedAdditionalObjectClasses, final String expectedObjectClass,
      final String[] objectClasses); }
LdapUtils { public static String escapeCommonName(final String name) { if (name == null) { return null; } final StringBuilder buf = new StringBuilder(name.length() + 5); for (int i = 0; i < name.length(); i++) { final char ch = name.charAt(i); if (",=+<>#;\\\"".indexOf(ch) >= 0) { buf.append("\\"); } buf.append(ch); } return buf.toString(); }  static String escapeCommonName(final String name); static String getOu(final String... organizationalUnits); static String getOu(final String ou, final String[] organizationalUnits); static void buildOu(final StringBuffer buf, final String ou, final String[] organizationalUnits); static void buildOu(final StringBuffer buf, final String... organizationalUnits); static void appendOu(final StringBuffer buf, final String... organizationalUnits); static String getOrganizationalUnit(final String dn); static String getOrganizationalUnit(final String dn, final String ouBase); static Object getAttributeValue(final Attributes attributes, final String attrId); static String getAttributeStringValue(final Attributes attributes, final String attrId); static String[] getAttributeStringValues(final Attributes attributes, final String attrId); static Integer getAttributeIntegerValue(final Attributes attributes, final String attrId); static Attribute putAttribute(final Attributes attributes, final String attrId, final String attrValue); static String splitMultipleAttribute(final String attrId, final String value); static List<String> getMissedObjectClasses(final String[] expectedAdditionalObjectClasses, final String expectedObjectClass,
      final String[] objectClasses);  }