From e8804e8f840598b20b1a3a97b0c5dd45a591d362 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 9 Jan 2024 14:03:29 +0900 Subject: [PATCH] =?UTF-8?q?close=E5=87=A6=E7=90=86=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/processor/DocumentProcessor.java | 2 +- .../processor/impl/DocumentProcessorImpl.java | 20 +++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/processor/src/main/java/one/nem/lacerta/processor/DocumentProcessor.java b/processor/src/main/java/one/nem/lacerta/processor/DocumentProcessor.java index 7d4e9fcb..abca8a84 100644 --- a/processor/src/main/java/one/nem/lacerta/processor/DocumentProcessor.java +++ b/processor/src/main/java/one/nem/lacerta/processor/DocumentProcessor.java @@ -18,7 +18,7 @@ public interface DocumentProcessor { Bitmap getPageAtIndex(int index); int getPageCount(); - void close(); + void close() throws Exception; void init() throws Exception; // TODO-rca: 例外処理 } 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 2b1959dd..16213258 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 @@ -148,18 +148,16 @@ public class DocumentProcessorImpl implements DocumentProcessor{ } @Override - public void close() { + public void close() throws Exception{ logger.debug("close", "called"); - // TODO-rca: ここでxmlファイルを保存する - this.fileManager.backRootDir(); - - try { - this.fileManager.saveDocument(xmlMetaParser.serialize(xmlMetaModel), "meta.xml"); - logger.debug("close", "meta.xml saved"); - } catch (Exception e) { - logger.error("close", "meta.xml save failed"); - logger.trace("close", e.getMessage()); + if (this.fileManager.isExist("meta.xml")) { + try { + this.fileManager.createFile("meta.xml").saveXml(xmlMetaParser.serialize(xmlMetaModel)); + logger.debug("close", "meta.xml saved"); + } catch (Exception e) { + logger.error("close", "meta.xml save failed"); + logger.trace("close", e.getMessage()); + } } - logger.info("close", "finished"); } }