diff --git a/src/main/java/com/emr/controller/templateSearch/TemplateSearchController.java b/src/main/java/com/emr/controller/templateSearch/TemplateSearchController.java index 17469bb..61cee73 100644 --- a/src/main/java/com/emr/controller/templateSearch/TemplateSearchController.java +++ b/src/main/java/com/emr/controller/templateSearch/TemplateSearchController.java @@ -1344,6 +1344,8 @@ public class TemplateSearchController { while ((len = bis.read(buf, 0, buf.length)) != -1) { bos.write(buf, 0, len); } + bis.close(); // 及时关闭流,避免资源泄露 + out.reset(); } } catch (Exception e) { ExceptionPrintUtil.printException(e); diff --git a/src/main/java/com/emr/service/batchExport/BatchExportServiceImpl.java b/src/main/java/com/emr/service/batchExport/BatchExportServiceImpl.java index 1da3ecb..35515f5 100644 --- a/src/main/java/com/emr/service/batchExport/BatchExportServiceImpl.java +++ b/src/main/java/com/emr/service/batchExport/BatchExportServiceImpl.java @@ -295,7 +295,7 @@ public class BatchExportServiceImpl implements BatchExportService { public Boolean imageToPdf1(List scanPathVos, ByteArrayOutputStream bos, EmrPdfWaterSet pdfWaterSet) { //ByteArrayOutputStream bos = null; - FileOutputStream fileOutputStream = null; + //FileOutputStream fileOutputStream = null; PdfWriter writer = null; try { //bos = new ByteArrayOutputStream(); @@ -380,22 +380,20 @@ public class BatchExportServiceImpl implements BatchExportService { e.printStackTrace(); return false; } finally { - //try { + try { if (writer != null) { writer.close(); } /*if (fileOutputStream != null) { fileOutputStream.close(); - } - + }*/ if (bos != null) { bos.flush(); bos.close(); - }*/ - - /*} catch (IOException e) { + } + } catch (IOException e) { e.printStackTrace(); - }*/ + } } return true; }