From 2cc5060d0cbd44355625db17a712a32c5298f9d7 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Wed, 17 Jan 2024 12:44:48 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sprt/service/bean/IntegrationSearchServiceBean.java | 8 ++++++++ .../java/cokr/xit/fims/sprt/service/bean/MediaBean.java | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/cokr/xit/fims/sprt/service/bean/IntegrationSearchServiceBean.java b/src/main/java/cokr/xit/fims/sprt/service/bean/IntegrationSearchServiceBean.java index fa57b111..095a6431 100644 --- a/src/main/java/cokr/xit/fims/sprt/service/bean/IntegrationSearchServiceBean.java +++ b/src/main/java/cokr/xit/fims/sprt/service/bean/IntegrationSearchServiceBean.java @@ -601,6 +601,10 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements String imagesFolderPath = outsourcingResultPath + File.separator + imagesFolderName; String metaFilePath = outsourcingResultPath + File.separator + metaFileName; + File imagesFolderPathFile = new File(imagesFolderPath); + if (!imagesFolderPathFile.exists()) { + imagesFolderPathFile.mkdirs(); + } for(int i=0; i < dataObjectList.size(); i++) { DataObject dataObject = dataObjectList.get(i); @@ -618,6 +622,10 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements File orgnFile = new File(fileInfo.string("FILE_PATH")); + if(!orgnFile.exists() || !orgnFile.canRead()) { + continue; + } + String modifiedFileName = "P"+fileInfo.string("INF_KEY")+CmmnUtil.indexToAlphabet(j, true)+"."+"JPG"; String modifiedFilePath = imagesFolderPath + File.separator + modifiedFileName; diff --git a/src/main/java/cokr/xit/fims/sprt/service/bean/MediaBean.java b/src/main/java/cokr/xit/fims/sprt/service/bean/MediaBean.java index 6b86a96f..fb2fc4ea 100644 --- a/src/main/java/cokr/xit/fims/sprt/service/bean/MediaBean.java +++ b/src/main/java/cokr/xit/fims/sprt/service/bean/MediaBean.java @@ -81,8 +81,13 @@ public class MediaBean extends AbstractComponent { List result = new ArrayList<>(); try { + File imageFile = new File(imagePath); + if(!imageFile.exists() || !imageFile.canRead()) { + result.add(new PstnAndSize(0, 0, 0, 0)); + return result; + } - BufferedImage image = ImageIO.read(new File(imagePath)); + BufferedImage image = ImageIO.read(imageFile); float originalWidth = image.getWidth(null); float originalHeight = image.getHeight(null); float transX = pstnAndSize_in_print.getWidth() / originalWidth;