String (final String data) { String reason; if ((reason = checkCharacterData(data)) != null) { return reason; } if (data.contains("--")) { return "Comments cannot contain double hyphens (--)"; } if (data.endsWith("-")) { return "Comment data cannot end with a hyphen."; } // If we got here, everything is OK return null; }