Generated zip file from java is working on local but not on another environment
<p>I'll try to be short on explaining where my problem is. I have a JSP/Servlet application in which I tried to make a ZIP file and send this file to the browser in the response.</p>

<p>After a lot of work everything started working smoothly both on local and both on another environment we deploy our application. Nothing changed in the code regarding the creation and delivering the ZIP file, but since yesterday the ZIP file doesn't work an the deploy environment anymore. I get the unexpected end of file error when trying to download the zip in the first time, and after the first time I always get the archive is either unknown format or damaged error.</p>

<p>There is not a problem with the files I try to put in the ZIP since I'm able to see them from the deploy environment. I've started to think that maybe there could be a library or a jar or a configuration on the server that might make the ZIP file not work as on the local environment.</p>

<p>Does that even make sense? Below, you can find the code: </p>

<pre><code>ByteArrayOutputStream out = new ByteArrayOutputStream();
ZipOutputStream zipOutputStream = new ZipOutputStream(out);
for (....) {
    DocumentVO documentVO = ....;
    String fileName = ....;
    CRC32 crc = new CRC32();
    crc.reset();
    ZipEntry zipEntry = new ZipEntry(fileName);
    byte[] content = documentVO.getDocumentContent();
    crc.update(documentVO.getDocumentContent());
    zipEntry.setMethod(ZipEntry.STORED);
    zipEntry.setSize(content.length);
    zipEntry.setCrc(crc.getValue());
    zipEntry.setCompressedSize(content.length);
    zipOutputStream.putNextEntry(zipEntry);
    zipOutputStream.write(content);
    zipOutputStream.closeEntry();
}
zipOutputStream.finish();
zipOutputStream.close();
response.setHeader("Content-Type", "application/zip");
response.setHeader("Content-Disposition","attachment; filename=correspondence.zip");
response.getOutputStream().write(out.toByteArray());
response.getOutputStream().flush();
</code></pre>

<p>Every idea would be appreciated. </p>
