From 6b3d0c0dae389892810481752a17059a64b654f7 Mon Sep 17 00:00:00 2001 From: r-ca Date: Wed, 24 Jan 2024 18:36:08 +0900 Subject: [PATCH] =?UTF-8?q?=E5=A4=B1=E6=95=97=E3=81=97=E3=81=9F=E3=81=A8?= =?UTF-8?q?=E3=81=8D=E3=81=AB=E3=83=AD=E3=82=B0=E3=82=92=E5=89=8A=E9=99=A4?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=83=AA=E3=82=AB=E3=83=90=E3=83=AA=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../processor/impl/DocumentProcessorImpl.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java b/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java index 5b580cf8..fea8396f 100644 --- a/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java +++ b/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java @@ -76,16 +76,22 @@ public class DocumentProcessorImpl implements DocumentProcessor{ lacertaVcs.insertPage(this.documentDetail.getPages().size(), filename); - Page page = new Page(); - page.setFileName(filename); - page.setBitmap(bitmap); - this.documentDetail.getPages().add(page); + try { + Page page = new Page(); + page.setFileName(filename); + page.setBitmap(bitmap); + this.documentDetail.getPages().add(page); - this.fileManager.getNewInstance().createDirectoryIfNotExist(DEFAULT_SAVE_DIR).resolve(DEFAULT_SAVE_DIR).saveBitmap(bitmap, filename); - - logger.info("addNewPageToLast", "finished"); - logger.info("addNewPageToLast", "filename: " + filename); + this.fileManager.getNewInstance().createDirectoryIfNotExist(DEFAULT_SAVE_DIR).resolve(DEFAULT_SAVE_DIR).saveBitmap(bitmap, filename); + logger.info("addNewPageToLast", "finished"); + logger.info("addNewPageToLast", "filename: " + filename); + } catch (Exception e) { + logger.error("addNewPageToLast", "failed: Unknown error"); + logger.e_code("d9191286-6092-40b3-80ed-9239106a8c65"); + // Recover (Undo latest action) + lacertaVcs.undo(); + } return this; }