Skip to content
Permalink
Browse files

[JENKINS-15382] not sure which code is triggering animal sniffer viol…

…ation

(cherry picked from commit f7671e6)
  • Loading branch information...
kohsuke authored and olivergondza committed Jul 2, 2013
1 parent fca0ea8 commit bcf9a84f18e42d41f268bd62e6e62d56d2f9b23b
Showing with 4 additions and 4 deletions.
  1. +4 −4 core/src/main/java/hudson/tasks/junit/CaseResult.java
@@ -138,23 +138,23 @@ private static float parseTime(Element testCase) {
}

private static final int HALF_MAX_SIZE = 500;
static String possiblyTrimStdio(Collection<CaseResult> results, boolean keepLongStdio, CharSequence stdio) { // HUDSON-6516
static String possiblyTrimStdio(Collection<CaseResult> results, boolean keepLongStdio, String stdio) { // HUDSON-6516
if (stdio == null) {
return null;
}
if (!isTrimming(results, keepLongStdio)) {
return stdio.toString();
return stdio;
}
int len = stdio.length();
int middle = len - HALF_MAX_SIZE * 2;
if (middle <= 0) {
return stdio.toString();
return stdio;
}
return stdio.subSequence(0, HALF_MAX_SIZE) + "\n...[truncated " + middle + " chars]...\n" + stdio.subSequence(len - HALF_MAX_SIZE, len);
}

/**
* Flavor of {@link #possiblyTrimStdio(Collection, boolean, CharSequence)} that doesn't try to read the whole thing into memory.
* Flavor of {@link #possiblyTrimStdio(Collection, boolean, String)} that doesn't try to read the whole thing into memory.
*/
static String possiblyTrimStdio(Collection<CaseResult> results, boolean keepLongStdio, File stdio) throws IOException {
if (!isTrimming(results, keepLongStdio) && stdio.length()<1024*1024) {

0 comments on commit bcf9a84

Please sign in to comment.
You can’t perform that action at this time.