vy commented on code in PR #3212: URL: https://github.com/apache/logging-log4j2/pull/3212#discussion_r1846325058
########## log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/StackTraceStringResolver.java: ########## @@ -253,13 +253,14 @@ else if (bufferIndex < (endIndex - 12) private static int findLineStartIndex(final CharSequence buffer, final int startIndex, final int endIndex) { char prevChar = '-'; - for (int i = startIndex; i <= endIndex; i++) { + int i = startIndex; + for (; i < endIndex; i++) { if (prevChar == '\n') { return i; } prevChar = buffer.charAt(i); } - return -1; + return prevChar == '\n' ? i : -1; Review Comment: This is to return 4 when the input is `("abc\nd", 0, 3)`. But looking at it again, this use case doesn't exist anymore and the loop can even be further simplified: see fd55d26c02b207bd8a9639a895b2240394aeda41. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org