diff --git a/ccm-core/src/main/java/org/libreccm/files/CcmFiles.java b/ccm-core/src/main/java/org/libreccm/files/CcmFiles.java
index 33a130516..06b635d7b 100644
--- a/ccm-core/src/main/java/org/libreccm/files/CcmFiles.java
+++ b/ccm-core/src/main/java/org/libreccm/files/CcmFiles.java
@@ -172,9 +172,10 @@ public class CcmFiles {
if (adapter.isConfigured()) {
return adapter;
} else {
- throw new UnexpectedErrorException(
+ throw new CcmFilesNotConfiguredException(
"Only the default FileSystemAdapter is available but is "
- + "not correctly configured.");
+ + "not correctly configured."
+ );
}
}
}
@@ -196,7 +197,9 @@ public class CcmFiles {
final String dataPath = filesConf.getDataPath();
if (dataPath == null || dataPath.trim().isEmpty()) {
- throw new UnexpectedErrorException("dataPath is not configured.");
+ throw new CcmFilesNotConfiguredException(
+ "dataPath is not configured."
+ );
}
if (dataPath.endsWith("/")) {
diff --git a/ccm-core/src/main/java/org/libreccm/files/CcmFilesNotConfiguredException.java b/ccm-core/src/main/java/org/libreccm/files/CcmFilesNotConfiguredException.java
new file mode 100644
index 000000000..ad77ded70
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/files/CcmFilesNotConfiguredException.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+package org.libreccm.files;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class CcmFilesNotConfiguredException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Creates a new instance of CcmFilesNotConfiguredException without detail message.
+ */
+ public CcmFilesNotConfiguredException() {
+ super();
+ }
+
+
+ /**
+ * Constructs an instance of CcmFilesNotConfiguredException with the specified detail message.
+ *
+ * @param msg The detail message.
+ */
+ public CcmFilesNotConfiguredException(final String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs an instance of CcmFilesNotConfiguredException which wraps the
+ * specified exception.
+ *
+ * @param exception The exception to wrap.
+ */
+ public CcmFilesNotConfiguredException(final Exception exception) {
+ super(exception);
+ }
+
+ /**
+ * Constructs an instance of CcmFilesNotConfiguredException with the specified message which also wraps the
+ * specified exception.
+ *
+ * @param msg The detail message.
+ * @param exception The exception to wrap.
+ */
+ public CcmFilesNotConfiguredException(final String msg, final Exception exception) {
+ super(msg, exception);
+ }
+}
diff --git a/ccm-core/src/main/java/org/libreccm/theming/FileSystemThemeProvider.java b/ccm-core/src/main/java/org/libreccm/theming/FileSystemThemeProvider.java
index b66210d5f..7a3c1b3ce 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/FileSystemThemeProvider.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/FileSystemThemeProvider.java
@@ -18,8 +18,11 @@
*/
package org.libreccm.theming;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.files.CcmFiles;
+import org.libreccm.files.CcmFilesNotConfiguredException;
import org.libreccm.files.DirectoryNotEmptyException;
import org.libreccm.files.FileAccessException;
import org.libreccm.files.FileAlreadyExistsException;
@@ -53,6 +56,10 @@ import javax.inject.Inject;
public class FileSystemThemeProvider implements ThemeProvider {
private static final long serialVersionUID = 1L;
+
+ private static final Logger LOGGER = LogManager.getLogger(
+ FileSystemThemeProvider.class
+ );
private static final String BASE_PATH = "/themes";
private static final String DRAFT_THEMES_PATH = BASE_PATH + "/draft";
@@ -74,7 +81,6 @@ public class FileSystemThemeProvider implements ThemeProvider {
public List getThemes() {
try {
-
if (!ccmFiles.isDirectory(BASE_PATH)
|| !ccmFiles.isDirectory(DRAFT_THEMES_PATH)) {
@@ -92,8 +98,10 @@ public class FileSystemThemeProvider implements ThemeProvider {
} catch (FileAccessException
| FileDoesNotExistException
| InsufficientPermissionsException ex) {
-
throw new UnexpectedErrorException(ex);
+ } catch(CcmFilesNotConfiguredException ex) {
+ LOGGER.warn(ex);
+ return Collections.emptyList();
}
}
@@ -119,6 +127,9 @@ public class FileSystemThemeProvider implements ThemeProvider {
| InsufficientPermissionsException ex) {
throw new UnexpectedErrorException(ex);
+ } catch(CcmFilesNotConfiguredException ex) {
+ LOGGER.warn(ex);
+ return Collections.emptyList();
}
}
diff --git a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/sites.xhtml b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/sites/sites.xhtml
similarity index 100%
rename from ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/sites.xhtml
rename to ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/sites/sites.xhtml