ZipFile and Socket are not Closable in java 1.6

This commit is contained in:
Federico Fissore 2015-05-22 09:21:07 +02:00
parent 181211eb40
commit 76c5d99123
2 changed files with 14 additions and 4 deletions

View File

@ -966,7 +966,13 @@ public class Editor extends JFrame implements RunnerListener {
//System.err.println("Ignoring " + filename + " (" + e.getMessage() + ")"); //System.err.println("Ignoring " + filename + " (" + e.getMessage() + ")");
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
IOUtils.closeQuietly(zipFile); if (zipFile != null) {
try {
zipFile.close();
} catch (IOException e) {
// noop
}
}
} }
return null; return null;
} }

View File

@ -1,7 +1,5 @@
package processing.app.helpers; package processing.app.helpers;
import org.apache.commons.compress.utils.IOUtils;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
@ -45,7 +43,13 @@ public abstract class NetUtils {
} catch (IOException e) { } catch (IOException e) {
return false; return false;
} finally { } finally {
IOUtils.closeQuietly(socket); if (socket != null) {
try {
socket.close();
} catch (IOException e) {
// noop
}
}
} }
} }
} }