public boolean checkName(String name, Client client, boolean allowSpaces) { // TODO: check for dev names, profane names, iconic names etc try { if (checkForDuplicateName(name, client.getAccountId()) || (!allowSpaces && !name.matches(allowedCharsRegex)) || (allowSpaces && !name.matches(allowedCharsRegexWithSpace))) return false; } catch (SQLException e) { e.printStackTrace(); } return true; }