提交 92f54b44 编写于 作者: M mindless

avoid repeated maxDescrLength-ending.length() calculations in getTruncatedDescription


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21951 71c3de6d-444a-0410-be80-ed276b4c234a
上级 b957f012
......@@ -445,8 +445,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
}
final String ending = "...";
int sz = description.length();
final int sz = description.length(), maxTruncLength = maxDescrLength - ending.length();
boolean inTag = false;
int displayChars = 0;
......@@ -458,16 +457,14 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
inTag = true;
} else if (ch == '>') {
inTag = false;
if (displayChars <= (maxDescrLength - ending.length())) {
if (displayChars <= maxTruncLength) {
lastTruncatablePoint = i + 1;
}
}
if (!inTag) {
displayChars++;
if (displayChars <= (maxDescrLength - ending.length())) {
if (ch == ' ') {
lastTruncatablePoint = i;
}
if (displayChars <= maxTruncLength && ch == ' ') {
lastTruncatablePoint = i;
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册