Skip to content

Commit 7c99339

Browse files
authored
Fixed sonar warnings.
1 parent 72ddf92 commit 7c99339

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/main/java/com/github/underscore/U.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1945,7 +1945,7 @@ public byte[] blob() {
19451945

19461946
public String text() {
19471947
try {
1948-
return stream.toString("UTF-8");
1948+
return stream.toString(StandardCharsets.UTF_8.name());
19491949
} catch (java.io.UnsupportedEncodingException ex) {
19501950
throw new UnsupportedOperationException(ex);
19511951
}

src/main/java/com/github/underscore/Xml.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,8 +1515,9 @@ private static String unescapeName(final String name) {
15151515
StringBuilder result = new StringBuilder();
15161516
int underlineCount = 0;
15171517
StringBuilder lastChars = new StringBuilder();
1518+
int i = 0;
15181519
outer:
1519-
for (int i = 0; i < length; ++i) {
1520+
while (i < length) {
15201521
char ch = name.charAt(i);
15211522
if (ch == '_') {
15221523
lastChars.append(ch);
@@ -1535,6 +1536,7 @@ private static String unescapeName(final String name) {
15351536
i = j;
15361537
underlineCount = 0;
15371538
lastChars.setLength(0);
1539+
i++;
15381540
continue outer;
15391541
}
15401542
} else {
@@ -1546,6 +1548,7 @@ private static String unescapeName(final String name) {
15461548
result.append(lastChars).append(ch);
15471549
lastChars.setLength(0);
15481550
}
1551+
i++;
15491552
}
15501553
return result.append(lastChars).toString();
15511554
}

0 commit comments

Comments
 (0)