From 132991122fbc1723a3d9d089722df7bb58f34977 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 16 Dec 2023 14:22:38 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AD=E3=82=B0=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/source/jgit/impl/ActionRepoImpl.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/src/main/java/one/nem/lacerta/source/jgit/impl/ActionRepoImpl.java b/source/src/main/java/one/nem/lacerta/source/jgit/impl/ActionRepoImpl.java index d6fecad9..f589da02 100644 --- a/source/src/main/java/one/nem/lacerta/source/jgit/impl/ActionRepoImpl.java +++ b/source/src/main/java/one/nem/lacerta/source/jgit/impl/ActionRepoImpl.java @@ -3,10 +3,18 @@ package one.nem.lacerta.source.jgit.impl; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.lib.Repository; +import javax.inject.Inject; + import one.nem.lacerta.source.jgit.ActionRepo; +import one.nem.lacerta.utils.LacertaLogger; public class ActionRepoImpl implements ActionRepo{ + @Inject // Inject logger + LacertaLogger logger; + + private final String TAG = "ActionRepoImpl"; + Repository repository; Git git; @@ -14,6 +22,7 @@ public class ActionRepoImpl implements ActionRepo{ // Internal method private Git getGit() { if (this.git == null) { + logger.debug(TAG, "getGit: git is null. Creating new Git instance"); this.git = new Git(repository); } return this.git; @@ -27,6 +36,7 @@ public class ActionRepoImpl implements ActionRepo{ @Override public Repository getRepository() { if (repository == null) { + logger.warn(TAG, "getRepository: repository is null. Throwing RuntimeException"); throw new RuntimeException("リポジトリが設定されていません"); } return repository; @@ -43,6 +53,7 @@ public class ActionRepoImpl implements ActionRepo{ try { return git.status().call().getUntracked().toArray(new String[0]); } catch (Exception e) { // TODO-rca: エラーハンドリング + logger.error(TAG, "getUnstagedFiles: " + e.getMessage()); return new String[0]; } } @@ -53,6 +64,7 @@ public class ActionRepoImpl implements ActionRepo{ try { return git.status().call().getAdded().toArray(new String[0]); } catch (Exception e) { // TODO-rca: エラーハンドリング + logger.error(TAG, "getStagedFiles: " + e.getMessage()); return new String[0]; } }