String (@NotNull CharSequence line) { String lineString; String formatString = "%s...(%d more characters)...%s"; if (line.length() > INPUT_ERROR_MESSAGE_HEAD_LIMIT + INPUT_ERROR_MESSAGE_TAIL_LIMIT + formatString.length()) { lineString = String.format(formatString, line.subSequence(0, INPUT_ERROR_MESSAGE_HEAD_LIMIT), (line.length() - INPUT_ERROR_MESSAGE_HEAD_LIMIT - INPUT_ERROR_MESSAGE_TAIL_LIMIT), line.subSequence(line.length() - INPUT_ERROR_MESSAGE_TAIL_LIMIT, line.length())); } else { lineString = line.toString(); } return StringUtil.escapeStringCharacters(lineString); }