Source:
public String[] getUserListFromProperties(String property, String value, String profileName) throws UserStoreException { if (profileName == null) { profileName = UserCoreConstants.DEFAULT_PROFILE; } if(value == null){ throw new IllegalArgumentException("Filter value cannot be null"); } if (value.contains(QUERY_FILTER_STRING_ANY)) { if (!(value.length() == 2 && value.startsWith(QUERY_FILTER_STRING_ANY) && value.endsWith (QUERY_FILTER_STRING_ANY)) && value.charAt(value.length() - 2) != SQL_FILTER_CHAR_ESCAPE) { value = value.replaceAll("(?<!\\\\)\\*", SQL_FILTER_STRING_ANY); } } String[] users = new String[0]; Connection dbConnection = null; String sqlStmt = null; PreparedStatement prepStmt = null; ResultSet rs = null; List<String> list = new ArrayList<String>(); try { dbConnection = getDBConnection(); sqlStmt = realmConfig.getUserStoreProperty(JDBCRealmConstants.GET_USERS_FOR_PROP); prepStmt = dbConnection.prepareStatement(sqlStmt); prepStmt.setString(1, property); prepStmt.setString(2, value); prepStmt.setString(3, profileName); if (sqlStmt.contains(UserCoreConstants.UM_TENANT_COLUMN)) { prepStmt.setInt(4, tenantId); prepStmt.setInt(5, tenantId); } rs = prepStmt.executeQuery(); while (rs.next()) { String name = rs.getString(1); list.add(name); } if (list.size() > 0) { users = list.toArray(new String[list.size()]); } } catch (SQLException e) { String msg = "Database error occurred while listing users for a property : " + property + " & value : " + value + " & profile name : " + profileName; if (log.isDebugEnabled()) { log.debug(msg, e); } throw new UserStoreException(msg, e); } finally { DatabaseUtil.closeAllConnections(dbConnection, rs, prepStmt); } return users; }

Target:
public String[] getUserListFromProperties(String property, String value, String profileName) throws UserStoreException { if (profileName == null) { profileName = UserCoreConstants.DEFAULT_PROFILE; } if(value == null){ throw new IllegalArgumentException("Filter value cannot be null"); } if (value.contains(QUERY_FILTER_STRING_ANY)) { if (!value.matches("(\\*)\\1+")) { value = value.replaceAll("(?<!\\\\)\\*", SQL_FILTER_STRING_ANY); } } String[] users = new String[0]; Connection dbConnection = null; String sqlStmt = null; PreparedStatement prepStmt = null; ResultSet rs = null; List<String> list = new ArrayList<String>(); try { dbConnection = getDBConnection(); sqlStmt = realmConfig.getUserStoreProperty(JDBCRealmConstants.GET_USERS_FOR_PROP); prepStmt = dbConnection.prepareStatement(sqlStmt); prepStmt.setString(1, property); prepStmt.setString(2, value); prepStmt.setString(3, profileName); if (sqlStmt.contains(UserCoreConstants.UM_TENANT_COLUMN)) { prepStmt.setInt(4, tenantId); prepStmt.setInt(5, tenantId); } rs = prepStmt.executeQuery(); while (rs.next()) { String name = rs.getString(1); list.add(name); } if (list.size() > 0) { users = list.toArray(new String[list.size()]); } } catch (SQLException e) { String msg = "Database error occurred while listing users for a property : " + property + " & value : " + value + " & profile name : " + profileName; if (log.isDebugEnabled()) { log.debug(msg, e); } throw new UserStoreException(msg, e); } finally { DatabaseUtil.closeAllConnections(dbConnection, rs, prepStmt); } return users; }