@@ -108,6 +108,7 @@ public abstract class AbstractArchiver
108
108
// On lunix-like systems, we replace windows backslashes with forward slashes
109
109
private final boolean replacePathSlashesToJavaPaths = File .separatorChar == '/' ;
110
110
111
+ private final List <Closeable > closeables = new ArrayList <Closeable >( );
111
112
/**
112
113
* since 2.2 is on by default
113
114
*
@@ -523,7 +524,7 @@ else if ( o instanceof PlexusIoResourceCollection )
523
524
// to the client and ditch the whole issue onto the client.
524
525
// this does not really make any sense either, might equally well change the
525
526
// api into something that is not broken by design.
526
- closeQuietlyIfCloseable ( ioResourceIter );
527
+ addCloseable ( ioResourceIter );
527
528
ioResourceIter = null ;
528
529
}
529
530
}
@@ -1041,12 +1042,27 @@ protected void validate()
1041
1042
1042
1043
protected abstract String getArchiveType ();
1043
1044
1045
+ private void addCloseable (Object maybeCloseable ){
1046
+ if (maybeCloseable instanceof Closeable )
1047
+ closeables .add ( (Closeable ) maybeCloseable );
1048
+
1049
+ }
1050
+ private void closeIterators ()
1051
+ {
1052
+ for ( Closeable closeable : closeables )
1053
+ {
1054
+ closeQuietlyIfCloseable ( closeable );
1055
+ }
1056
+
1057
+ }
1044
1058
protected abstract void close ()
1045
1059
throws IOException ;
1046
1060
1047
1061
protected void cleanUp ()
1048
1062
throws IOException
1049
1063
{
1064
+ closeIterators ();
1065
+
1050
1066
for ( Object resource : resources )
1051
1067
{
1052
1068
if ( resource instanceof PlexusIoProxyResourceCollection )
0 commit comments