Hi,
There is a bug in method exportBarProcessContentUnderHome in org.bonitasoft.engine.api.impl.ProcessAPIImpl class. Usually retured archive is invalid and cannot be unzipped later on. The problem is in closing ZipOutputStream too late (or return it’s content too soon) so it is not finished yet. Please consider to alter the code.
Now this particular part of code looks like this:
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final ZipOutputStream zos = new ZipOutputStream(baos);
try {
IOUtil.zipDir(processFolder.getPath(), zos, processFolder.getPath());
return baos.toByteArray();
} finally {
zos.close();
baos.close();
}
and should look like this:
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final ZipOutputStream zos = new ZipOutputStream(baos);
try {
IOUtil.zipDir(processFolder.getPath(), zos, processFolder.getPath());
} finally {
zos.close();
baos.close();
}
return baos.toByteArray();