From c48cdc5b024fd0bee82838736126587cb385069b Mon Sep 17 00:00:00 2001 From: fuqingji <51312040@qq.com> Date: Tue, 22 Mar 2022 16:11:28 +0800 Subject: [PATCH] 20220315-bugs --- .../service/impl/ExpertSignatureServiceImpl.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/signature/service/impl/ExpertSignatureServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/signature/service/impl/ExpertSignatureServiceImpl.java index 722b64e..18f1151 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/signature/service/impl/ExpertSignatureServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/signature/service/impl/ExpertSignatureServiceImpl.java @@ -125,20 +125,18 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService { File f = new File(path + "merged.pdf"); FileOutputStream fos = null; - FontSettings.getDefaultInstance().setFontsFolder(fontAddress, true); try { + FontSettings.getDefaultInstance().setFontsFolder(fontAddress, true); fos = new FileOutputStream(f); com.aspose.words.Document doc = new com.aspose.words.Document(path + "merged.docx"); doc.save(fos, SaveFormat.PDF); + fos.flush(); } catch (Exception e) { log.info(ExceptionUtil.stacktraceToString(e)); } finally { - source.close(); - addObj.close(); - if (fos != null) { - fos.flush(); - fos.close(); - } + IOUtils.closeQuietly(source); + IOUtils.closeQuietly(addObj); + IOUtils.closeQuietly(fos); }