You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2021/12/13 14:18:01 UTC

[jackrabbit-filevault] branch JCRVLT-575 updated: JCRVLT-575: also log the exception with stack trace, should it occur

This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch JCRVLT-575
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git


The following commit(s) were added to refs/heads/JCRVLT-575 by this push:
     new a78703b  JCRVLT-575: also log the exception with stack trace, should it occur
a78703b is described below

commit a78703b0407213694eb46cc820c015f5c5054e36
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Mon Dec 13 15:17:50 2021 +0100

    JCRVLT-575: also log the exception with stack trace, should it occur
---
 .../vault/packaging/registry/impl/FSInstallStateCache.java | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/registry/impl/FSInstallStateCache.java b/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/registry/impl/FSInstallStateCache.java
index 94a3eaf..6966e38 100644
--- a/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/registry/impl/FSInstallStateCache.java
+++ b/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/registry/impl/FSInstallStateCache.java
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.vault.packaging.registry.impl;
 
 import java.io.IOException;
 import java.io.UncheckedIOException;
+import java.nio.file.FileAlreadyExistsException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.AbstractMap;
@@ -30,6 +31,8 @@ import java.util.stream.Stream;
 
 import org.apache.jackrabbit.vault.packaging.PackageId;
 import org.jetbrains.annotations.NotNull;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Persisted cache of all {@link FSInstallState} objects for all packages in a registry.
@@ -39,6 +42,8 @@ import org.jetbrains.annotations.NotNull;
  */
 class FSInstallStateCache extends AbstractMap<PackageId, FSInstallState> {
 
+    private static final Logger log = LoggerFactory.getLogger(FSInstallStateCache.class);
+
     /**
      * Extension for metadata files
      */
@@ -55,8 +60,13 @@ class FSInstallStateCache extends AbstractMap<PackageId, FSInstallState> {
     private final Path homeDir;
 
     public FSInstallStateCache(Path homeDir) throws IOException {
-        this.homeDir = homeDir;
-        Files.createDirectories(homeDir.toRealPath());
+        try {
+            this.homeDir = homeDir;
+            Files.createDirectories(homeDir.toRealPath());
+        } catch (FileAlreadyExistsException ex) {
+            log.error("on createDirectories for " + homeDir + " (real path: " + homeDir.toRealPath() + ")", ex);
+            throw ex;
+        }
     }
 
     /**