From fe3d332a36b51d03e63b76f65601a84647bc058f Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 9 Jan 2024 15:56:47 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../processor/impl/DocumentProcessorImpl.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 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 8a7b8465..e876d44e 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 @@ -56,10 +56,13 @@ public class DocumentProcessorImpl implements DocumentProcessor{ logger.debug("init", "documentRootPath: " + this.documentRootPath); this.fileManager = fileManagerFactory.create(this.documentRootPath).enableAutoCreateParent(); //Initialize FileManager + + FileManager initFileManager = this.fileManager.getNewInstance(); + logger.debug("init", "fileManager created"); // xmlファイルの読み込み - if (fileManager.isExist("meta.xml")) { + if (initFileManager.isExist("meta.xml")) { logger.debug("init", "meta.xml found"); try { this.xmlMetaModel = xmlMetaParser.deserialize(this.fileManager.loadXml("meta.xml")); @@ -79,7 +82,7 @@ public class DocumentProcessorImpl implements DocumentProcessor{ xmlMetaModel.setPages(new ArrayList<>()); try { - this.fileManager.createFile("meta.xml").saveXml(xmlMetaParser.serialize(xmlMetaModel)); + initFileManager.createFileIfNotExist("meta.xml").saveXml(xmlMetaParser.serialize(xmlMetaModel), "meta.xml"); logger.debug("init", "meta.xml saved"); } catch (Exception e) { logger.error("init", "meta.xml save failed"); @@ -148,14 +151,12 @@ public class DocumentProcessorImpl implements DocumentProcessor{ @Override public void close() throws Exception{ logger.debug("close", "called"); - 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()); - } + try { + this.fileManager.createFileIfNotExist("meta.xml").saveXml(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()); } } }