You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2020/07/19 11:59:48 UTC
[maven-surefire] 01/01: a little improvement of
Utf8RecodingDeferredFileOutputStream
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit 6e895b1e2a66df7225ca333921e869ea704b9ce3
Author: tibordigana <ti...@apache.org>
AuthorDate: Sun Jul 19 13:58:14 2020 +0200
a little improvement of Utf8RecodingDeferredFileOutputStream
---
.../report/Utf8RecodingDeferredFileOutputStream.java | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/Utf8RecodingDeferredFileOutputStream.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/Utf8RecodingDeferredFileOutputStream.java
index a1a1f88..fabf938 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/Utf8RecodingDeferredFileOutputStream.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/Utf8RecodingDeferredFileOutputStream.java
@@ -33,16 +33,16 @@ import static org.apache.maven.surefire.api.util.internal.StringUtils.NL;
*
* @author Andreas Gudian
*/
-class Utf8RecodingDeferredFileOutputStream
+final class Utf8RecodingDeferredFileOutputStream
{
- private DeferredFileOutputStream deferredFileOutputStream;
+ private final DeferredFileOutputStream deferredFileOutputStream;
- private boolean closed = false;
+ private boolean closed;
@SuppressWarnings( "checkstyle:magicnumber" )
Utf8RecodingDeferredFileOutputStream( String channel )
{
- deferredFileOutputStream = new DeferredFileOutputStream( 1000000, channel, "deferred", null );
+ deferredFileOutputStream = new DeferredFileOutputStream( 1_000_000, channel, "deferred", null );
}
public synchronized void write( String output, boolean newLine )
@@ -88,12 +88,11 @@ class Utf8RecodingDeferredFileOutputStream
public synchronized void free()
{
- if ( null != deferredFileOutputStream && null != deferredFileOutputStream.getFile() )
+ if ( deferredFileOutputStream.getFile() != null )
{
try
{
- closed = true;
- deferredFileOutputStream.close();
+ close();
if ( !deferredFileOutputStream.getFile().delete() )
{
deferredFileOutputStream.getFile().deleteOnExit();
@@ -102,7 +101,6 @@ class Utf8RecodingDeferredFileOutputStream
catch ( IOException ioe )
{
deferredFileOutputStream.getFile().deleteOnExit();
-
}
}
}