Skip to content

Commit

Permalink
Stopped closing System.out through the closing of a decorating PrintW…
Browse files Browse the repository at this point in the history
…riter.
  • Loading branch information
JosePaumard authored and jeanbisutti committed May 9, 2020
1 parent beb8055 commit 3225e8f
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -28,9 +28,11 @@ private MeasureHeapAllocationPerfVerifier() { }
@Override
public PerfIssue verifyPerfIssue(MeasureHeapAllocation annotation, Allocation measuredAllocation) {
String allocationAsString = byteAllocationMeasureFormatter.format(measuredAllocation);
try (PrintWriter pw = new PrintWriter(System.out);) {
pw.printf(annotation.format(), allocationAsString);
}
PrintWriter pw = new PrintWriter(System.out);
pw.printf(annotation.format(), allocationAsString);
// do not call close on pw since it will call close on System.out
// thus preventing any further printing on the console
pw.flush();
return PerfIssue.NONE;
}

Expand Down

0 comments on commit 3225e8f

Please sign in to comment.