File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
commons-vfs2/src/test/java/org/apache/commons/vfs2 Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 2222
2323import java .io .OutputStream ;
2424import java .nio .charset .StandardCharsets ;
25- import java .nio .file .Files ;
2625import java .nio .file .Path ;
2726
2827import org .apache .commons .io .file .PathUtils ;
@@ -82,11 +81,21 @@ private boolean isWindows() {
8281 public void tearDown () throws Exception {
8382 final FileObject scratchFolder = getWriteFolder ();
8483 final FileObject file = scratchFolder .resolveFile (FILE_NAME );
85- file .setWritable (true , true );
84+ try {
85+ file .setReadable (true , false );
86+ } catch (final FileSystemException e ) {
87+ e .printStackTrace ();
88+ }
89+ try {
90+ file .setWritable (true , false );
91+ } catch (final FileSystemException e ) {
92+ e .printStackTrace ();
93+ }
8694 if (!file .delete ()) {
8795 final Path path = file .getPath ();
88- if (getFileSystem () instanceof LocalFileSystem ) {
89- PathUtils .deleteFile (path , StandardDeleteOption .OVERRIDE_READ_ONLY );
96+ if ((getFileSystem () instanceof LocalFileSystem )
97+ && (PathUtils .deleteFile (path , StandardDeleteOption .OVERRIDE_READ_ONLY ).getFileCounter ().get () == 0 )) {
98+ System .err .println ("Test tear down can't delete " + path );
9099 }
91100 }
92101 }
You can’t perform that action at this time.
0 commit comments