X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2FPluginStoreConfigurationBackend.java;h=a8a269743b6fe7eb5ab760408d8aa8a01cb230af;hp=5aa68cf659879b8433e475d227a9633ce2f0fdcb;hb=438378deab1514f0f608d975ef65f5b7aea44ccb;hpb=25ca7aaaa3b481e1d22d907427d53c83387b1a55 diff --git a/src/main/java/net/pterodactylus/sone/freenet/PluginStoreConfigurationBackend.java b/src/main/java/net/pterodactylus/sone/freenet/PluginStoreConfigurationBackend.java index 5aa68cf..a8a2697 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/PluginStoreConfigurationBackend.java +++ b/src/main/java/net/pterodactylus/sone/freenet/PluginStoreConfigurationBackend.java @@ -1,5 +1,5 @@ /* - * Sone - PluginStoreConfigurationBackend.java - Copyright © 2010 David Roden + * Sone - PluginStoreConfigurationBackend.java - Copyright © 2010–2020 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,27 +17,26 @@ package net.pterodactylus.sone.freenet; +import static java.util.logging.Logger.getLogger; + import java.util.logging.Logger; import net.pterodactylus.util.config.AttributeNotFoundException; import net.pterodactylus.util.config.Configuration; import net.pterodactylus.util.config.ConfigurationException; import net.pterodactylus.util.config.ExtendedConfigurationBackend; -import net.pterodactylus.util.logging.Logging; -import freenet.client.async.DatabaseDisabledException; +import freenet.client.async.PersistenceDisabledException; import freenet.pluginmanager.PluginRespirator; import freenet.pluginmanager.PluginStore; /** * Backend for a {@link Configuration} that is based on a {@link PluginStore}. - * - * @author David ‘Bombe’ Roden */ public class PluginStoreConfigurationBackend implements ExtendedConfigurationBackend { /** The logger. */ @SuppressWarnings("unused") - private static final Logger logger = Logging.getLogger(PluginStoreConfigurationBackend.class); + private static final Logger logger = getLogger(PluginStoreConfigurationBackend.class.getName()); /** The plugin respirator. */ private final PluginRespirator pluginRespirator; @@ -50,15 +49,12 @@ public class PluginStoreConfigurationBackend implements ExtendedConfigurationBac * * @param pluginRespirator * The plugin respirator - * @throws DatabaseDisabledException + * @throws PersistenceDisabledException * if the plugin store is not available */ - public PluginStoreConfigurationBackend(PluginRespirator pluginRespirator) throws DatabaseDisabledException { + public PluginStoreConfigurationBackend(PluginRespirator pluginRespirator) throws PersistenceDisabledException { this.pluginRespirator = pluginRespirator; this.pluginStore = pluginRespirator.getStore(); - if (this.pluginStore == null) { - throw new DatabaseDisabledException(); - } } /** @@ -176,8 +172,8 @@ public class PluginStoreConfigurationBackend implements ExtendedConfigurationBac public void save() throws ConfigurationException { try { pluginRespirator.putStore(pluginStore); - } catch (DatabaseDisabledException dde1) { - throw new ConfigurationException("Could not store plugin store, database is disabled.", dde1); + } catch (PersistenceDisabledException pde1) { + throw new ConfigurationException("Could not store plugin store, persistence is disabled.", pde1); } }