mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-11-02 13:31:49 +08:00
!889 fix: 修复 downloadCode 两个重载 ZipOutputStream 异常时未关闭问题
* fix: 修复 downloadCode 两个重载 ZipOutputStream 异常时未关闭问题
This commit is contained in:
parent
56b73f0432
commit
03e8f097b2
@ -341,8 +341,11 @@ public class GenTableServiceImpl implements IGenTableService {
|
||||
public byte[] downloadCode(Long tableId) {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||
writeCodeToZip(tableId, zip);
|
||||
IoUtil.close(zip);
|
||||
try {
|
||||
writeCodeToZip(tableId, zip);
|
||||
} finally {
|
||||
IoUtil.close(zip);
|
||||
}
|
||||
return outputStream.toByteArray();
|
||||
}
|
||||
|
||||
@ -408,10 +411,13 @@ public class GenTableServiceImpl implements IGenTableService {
|
||||
public byte[] downloadCode(String[] tableIds) {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||
for (String tableId : tableIds) {
|
||||
writeCodeToZip(Long.parseLong(tableId), zip);
|
||||
try {
|
||||
for (String tableId : tableIds) {
|
||||
writeCodeToZip(Long.parseLong(tableId), zip);
|
||||
}
|
||||
} finally {
|
||||
IoUtil.close(zip);
|
||||
}
|
||||
IoUtil.close(zip);
|
||||
return outputStream.toByteArray();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user