@@ -148,8 +148,8 @@ public CaseResult(
148148 this .errorStackTrace = stacktrace ;
149149 this .errorDetails = errorDetails ;
150150 this .parent = parent ;
151- this .stdout = stdout ;
152- this .stderr = stderr ;
151+ this .stdout = fixNULs ( stdout ) ;
152+ this .stderr = fixNULs ( stderr ) ;
153153 this .duration = duration ;
154154
155155 this .skipped = skippedMessage != null ;
@@ -189,8 +189,8 @@ public CaseResult(
189189 skippedMessage = getSkippedMessage (testCase );
190190 @ SuppressWarnings ("LeakingThisInConstructor" )
191191 Collection <CaseResult > _this = Collections .singleton (this );
192- stdout = possiblyTrimStdio (_this , keepLongStdio , testCase .elementText ("system-out" ));
193- stderr = possiblyTrimStdio (_this , keepLongStdio , testCase .elementText ("system-err" ));
192+ stdout = fixNULs ( possiblyTrimStdio (_this , keepLongStdio , testCase .elementText ("system-out" ) ));
193+ stderr = fixNULs ( possiblyTrimStdio (_this , keepLongStdio , testCase .elementText ("system-err" ) ));
194194 }
195195
196196 static String possiblyTrimStdio (Collection <CaseResult > results , boolean keepLongStdio , String stdio ) { // HUDSON-6516
@@ -209,6 +209,10 @@ static String possiblyTrimStdio(Collection<CaseResult> results, boolean keepLong
209209 return stdio .subSequence (0 , halfMaxSize ) + "\n ...[truncated " + middle + " chars]...\n " + stdio .subSequence (len - halfMaxSize , len );
210210 }
211211
212+ static String fixNULs (String stdio ) { // JENKINS-71139
213+ return stdio == null ? null : stdio .replace ("\u0000 " , "^@" );
214+ }
215+
212216 /**
213217 * Flavor of {@link #possiblyTrimStdio(Collection, boolean, String)} that doesn't try to read the whole thing into memory.
214218 */
0 commit comments