From 76f9f448c6300cb0dc2010866a0394418df6b5f0 Mon Sep 17 00:00:00 2001 From: fuqingji <51312040@qq.com> Date: Wed, 13 Apr 2022 10:35:03 +0800 Subject: [PATCH] 20220315-bugs --- .../service/impl/ExpertSignatureServiceImpl.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 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..41829f5 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 @@ -124,10 +124,9 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService { } File f = new File(path + "merged.pdf"); - FileOutputStream fos = null; + FontSettings.getDefaultInstance().setFontsFolder(fontAddress, true); - try { - fos = new FileOutputStream(f); + try (FileOutputStream fos = new FileOutputStream(f);) { com.aspose.words.Document doc = new com.aspose.words.Document(path + "merged.docx"); doc.save(fos, SaveFormat.PDF); } catch (Exception e) { @@ -135,11 +134,6 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService { } finally { source.close(); addObj.close(); - if (fos != null) { - fos.flush(); - fos.close(); - } - } long l1 = System.currentTimeMillis();