Skip to content

Commit 92ba117

Browse files
authored
Fix bug found by SonarQube in replaceAll (#417)
1 parent 3d1a427 commit 92ba117

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stubbornjava-webapp/src/main/java/com/stubbornjava/webapp/github/FileContentUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public static Map<String, FileContent.Section> parseContent(String raw) {
4747
int indentSpaces = matcher.group(1).length();
4848
StringBuilder sb = new StringBuilder();
4949
lines.stream().forEach(line -> {
50-
line.replaceAll("\t", " "); // replace tabs with 4 spaces
51-
sb.append(line.substring(Math.min(line.length(), indentSpaces)) + "\n");
50+
String replaced = line.replaceAll("\t", " "); // replace tabs with 4 spaces
51+
sb.append(line.substring(Math.min(replaced.length(), indentSpaces)) + "\n");
5252
});
5353
sections.put(sectionName, new FileContent.Section(startLineNum, endLineNum, sb.toString()));
5454
}

0 commit comments

Comments
 (0)