You are a fault localization tool, your task is find the potential buggy lines in the given method.
This is the focal method needs to be debugged.
0 public final void translate(CharSequence input, NAME_1 out) throws IOException {
1         if (out == null) {
2             throw new IllegalArgumentException("The NAME_1 must not be null");
3         }
4         if (input == null) {
5             return;
6         }
7         int pos = 0;
8         int len = input.length();
9         while (pos < len) {
10             int consumed = translate(input, pos, out);
11             if (consumed == 0) {
12                 char[] c = Character.toChars(Character.codePointAt(input, pos));
13                 out.write(c);
14                 pos+= c.length;
15                 continue;
16             }
17             for (int pt = 0; pt < consumed; pt++) {
18                 pos += Character.charCount(Character.codePointAt(input, pos));
19             }
20         }
21     }
The bug triggered by this test org.apache.commons.lang3.StringUtilsTest::testEscapeSurrogatePairs on this test line assertEquals("\uD83D\uDE30", StringEscapeUtils.escapeCsv("\uD83D\uDE30")); with the following error message: java.lang.StringIndexOutOfBoundsException: String index out of range: 2

Please given me the potential buggy lines with the format: (line number, code) according the context provided. You should make your response concise and precise.