@Test public void shouldNotExtractAttribute_nullParameter() { String attribute = LdapUtils.extractAttribute(null); Assert.assertNull(attribute); }
public static String extractAttribute(String filter) { if (filter == null) { return null; } String [] parts = filter.split(PROTECTED_FILTER_VARIABLE); if (parts.length > 1 || (parts.length == 1 && filter.endsWith(FILTER_VARIABLE))) { String attribute = parts[0]; int idxSep = Math.max(attribute.lastIndexOf(','), attribute.lastIndexOf('(')); int idx = (idxSep == -1) ? 0 : idxSep + 1; return attribute.substring(idx); } return null; }
LdapUtils { public static String extractAttribute(String filter) { if (filter == null) { return null; } String [] parts = filter.split(PROTECTED_FILTER_VARIABLE); if (parts.length > 1 || (parts.length == 1 && filter.endsWith(FILTER_VARIABLE))) { String attribute = parts[0]; int idxSep = Math.max(attribute.lastIndexOf(','), attribute.lastIndexOf('(')); int idx = (idxSep == -1) ? 0 : idxSep + 1; return attribute.substring(idx); } return null; } }
LdapUtils { public static String extractAttribute(String filter) { if (filter == null) { return null; } String [] parts = filter.split(PROTECTED_FILTER_VARIABLE); if (parts.length > 1 || (parts.length == 1 && filter.endsWith(FILTER_VARIABLE))) { String attribute = parts[0]; int idxSep = Math.max(attribute.lastIndexOf(','), attribute.lastIndexOf('(')); int idx = (idxSep == -1) ? 0 : idxSep + 1; return attribute.substring(idx); } return null; }  }
LdapUtils { public static String extractAttribute(String filter) { if (filter == null) { return null; } String [] parts = filter.split(PROTECTED_FILTER_VARIABLE); if (parts.length > 1 || (parts.length == 1 && filter.endsWith(FILTER_VARIABLE))) { String attribute = parts[0]; int idxSep = Math.max(attribute.lastIndexOf(','), attribute.lastIndexOf('(')); int idx = (idxSep == -1) ? 0 : idxSep + 1; return attribute.substring(idx); } return null; }  static String extractAttribute(String filter); static String addWhitespaceWildcards(String str); }
LdapUtils { public static String extractAttribute(String filter) { if (filter == null) { return null; } String [] parts = filter.split(PROTECTED_FILTER_VARIABLE); if (parts.length > 1 || (parts.length == 1 && filter.endsWith(FILTER_VARIABLE))) { String attribute = parts[0]; int idxSep = Math.max(attribute.lastIndexOf(','), attribute.lastIndexOf('(')); int idx = (idxSep == -1) ? 0 : idxSep + 1; return attribute.substring(idx); } return null; }  static String extractAttribute(String filter); static String addWhitespaceWildcards(String str);  }