Skip to content

Commit 6e895b1

Browse files
committed
a little improvement of Utf8RecodingDeferredFileOutputStream
1 parent 89d0d74 commit 6e895b1

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/Utf8RecodingDeferredFileOutputStream.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@
3333
*
3434
* @author Andreas Gudian
3535
*/
36-
class Utf8RecodingDeferredFileOutputStream
36+
final class Utf8RecodingDeferredFileOutputStream
3737
{
38-
private DeferredFileOutputStream deferredFileOutputStream;
38+
private final DeferredFileOutputStream deferredFileOutputStream;
3939

40-
private boolean closed = false;
40+
private boolean closed;
4141

4242
@SuppressWarnings( "checkstyle:magicnumber" )
4343
Utf8RecodingDeferredFileOutputStream( String channel )
4444
{
45-
deferredFileOutputStream = new DeferredFileOutputStream( 1000000, channel, "deferred", null );
45+
deferredFileOutputStream = new DeferredFileOutputStream( 1_000_000, channel, "deferred", null );
4646
}
4747

4848
public synchronized void write( String output, boolean newLine )
@@ -88,12 +88,11 @@ public synchronized void writeTo( OutputStream out )
8888

8989
public synchronized void free()
9090
{
91-
if ( null != deferredFileOutputStream && null != deferredFileOutputStream.getFile() )
91+
if ( deferredFileOutputStream.getFile() != null )
9292
{
9393
try
9494
{
95-
closed = true;
96-
deferredFileOutputStream.close();
95+
close();
9796
if ( !deferredFileOutputStream.getFile().delete() )
9897
{
9998
deferredFileOutputStream.getFile().deleteOnExit();
@@ -102,7 +101,6 @@ public synchronized void free()
102101
catch ( IOException ioe )
103102
{
104103
deferredFileOutputStream.getFile().deleteOnExit();
105-
106104
}
107105
}
108106
}

0 commit comments

Comments
 (0)