stream = new ZipOutputStream(os);
//do something...
}
}
Solution
To avoid resource leaks, ensure that close() is invoked on every java.util.zip.ZipOutputStream. Note: This rule applies to any form of ZipOutputStream constructor.
public class ClassA {
private ZipOutputStream stream;
public void makeStream (OutputStream os) {
stream = new ZipOutputStream(os);
//do something...