You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ag...@apache.org on 2014/01/02 12:25:02 UTC

git commit: SUREFIRE-1031 try to delete the file as early as possible, use deleteOnExit only as a fallback

Updated Branches:
  refs/heads/master 21737b868 -> 4d319a716


SUREFIRE-1031 try to delete the file as early as possible, use deleteOnExit only as a fallback


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/4d319a71
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/4d319a71
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/4d319a71

Branch: refs/heads/master
Commit: 4d319a716bbd2a5b7e03addf6cb8390a1e5b0193
Parents: 21737b8
Author: Andreas Gudian <ag...@apache.org>
Authored: Thu Jan 2 12:24:15 2014 +0100
Committer: Andreas Gudian <ag...@apache.org>
Committed: Thu Jan 2 12:24:15 2014 +0100

----------------------------------------------------------------------
 .../report/Utf8RecodingDeferredFileOutputStream.java  | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d319a71/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/Utf8RecodingDeferredFileOutputStream.java
----------------------------------------------------------------------
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 a2632a2..5c7b8a3 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
@@ -93,7 +93,19 @@ class Utf8RecodingDeferredFileOutputStream
     {
         if ( null != deferredFileOutputStream && null != deferredFileOutputStream.getFile() )
         {
-            deferredFileOutputStream.getFile().deleteOnExit();
+            try
+            {
+                deferredFileOutputStream.close();
+                if ( !deferredFileOutputStream.getFile().delete() )
+                {
+                    deferredFileOutputStream.getFile().deleteOnExit();
+                }
+            }
+            catch ( IOException ioe )
+            {
+                deferredFileOutputStream.getFile().deleteOnExit();
+
+            }
         }
     }
 }