mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-11-03 13:55:32 +08:00
update 优化 downloadCode 两个重载 ZipOutputStream 异常的处理方式。
This commit is contained in:
parent
03e8f097b2
commit
e1bdb03d69
@ -340,11 +340,10 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||||||
@Override
|
@Override
|
||||||
public byte[] downloadCode(Long tableId) {
|
public byte[] downloadCode(Long tableId) {
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
try(ZipOutputStream zip = new ZipOutputStream(outputStream)) {
|
||||||
try {
|
|
||||||
writeCodeToZip(tableId, zip);
|
writeCodeToZip(tableId, zip);
|
||||||
} finally {
|
} catch (IOException e) {
|
||||||
IoUtil.close(zip);
|
log.error("渲染模板失败,Zip输出流IO异常。", e);
|
||||||
}
|
}
|
||||||
return outputStream.toByteArray();
|
return outputStream.toByteArray();
|
||||||
}
|
}
|
||||||
@ -410,13 +409,12 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||||||
@Override
|
@Override
|
||||||
public byte[] downloadCode(String[] tableIds) {
|
public byte[] downloadCode(String[] tableIds) {
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
try(ZipOutputStream zip = new ZipOutputStream(outputStream)) {
|
||||||
try {
|
|
||||||
for (String tableId : tableIds) {
|
for (String tableId : tableIds) {
|
||||||
writeCodeToZip(Long.parseLong(tableId), zip);
|
writeCodeToZip(Long.parseLong(tableId), zip);
|
||||||
}
|
}
|
||||||
} finally {
|
} catch (IOException e) {
|
||||||
IoUtil.close(zip);
|
log.error("渲染模板失败,Zip输出流IO异常。", e);
|
||||||
}
|
}
|
||||||
return outputStream.toByteArray();
|
return outputStream.toByteArray();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user