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) {
|
public byte[] downloadCode(Long tableId) {
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||||
writeCodeToZip(tableId, zip);
|
try {
|
||||||
IoUtil.close(zip);
|
writeCodeToZip(tableId, zip);
|
||||||
|
} finally {
|
||||||
|
IoUtil.close(zip);
|
||||||
|
}
|
||||||
return outputStream.toByteArray();
|
return outputStream.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,10 +411,13 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||||||
public byte[] downloadCode(String[] tableIds) {
|
public byte[] downloadCode(String[] tableIds) {
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||||
for (String tableId : tableIds) {
|
try {
|
||||||
writeCodeToZip(Long.parseLong(tableId), zip);
|
for (String tableId : tableIds) {
|
||||||
|
writeCodeToZip(Long.parseLong(tableId), zip);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
IoUtil.close(zip);
|
||||||
}
|
}
|
||||||
IoUtil.close(zip);
|
|
||||||
return outputStream.toByteArray();
|
return outputStream.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user