Skip to content

Commit

Permalink
[JENKINS-15382] not sure which code is triggering animal sniffer viol…
Browse files Browse the repository at this point in the history
…ation

(cherry picked from commit f7671e6)
  • Loading branch information
kohsuke authored and olivergondza committed Sep 17, 2013
1 parent fca0ea8 commit bcf9a84
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/src/main/java/hudson/tasks/junit/CaseResult.java
Expand Up @@ -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) {
Expand Down

0 comments on commit bcf9a84

Please sign in to comment.