X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2FPluginStoreConfigurationBackend.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2FPluginStoreConfigurationBackend.java;h=97b463cd7108233f2b6379d337a5ac494f232fce;hp=e942b196df7bd5a8944a1bb5769f4d6aed3f1e25;hb=8cb84027861a382525fb206a6aa320a5796115a1;hpb=a75282a7e010c4e09774206570bc931b580eff9a diff --git a/src/main/java/net/pterodactylus/sone/freenet/PluginStoreConfigurationBackend.java b/src/main/java/net/pterodactylus/sone/freenet/PluginStoreConfigurationBackend.java index e942b19..97b463c 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/PluginStoreConfigurationBackend.java +++ b/src/main/java/net/pterodactylus/sone/freenet/PluginStoreConfigurationBackend.java @@ -17,6 +17,7 @@ package net.pterodactylus.sone.freenet; +import net.pterodactylus.util.config.AttributeNotFoundException; import net.pterodactylus.util.config.Configuration; import net.pterodactylus.util.config.ConfigurationException; import net.pterodactylus.util.config.ExtendedConfigurationBackend; @@ -47,6 +48,9 @@ public class PluginStoreConfigurationBackend implements ExtendedConfigurationBac */ @Override public String getValue(String attribute) throws ConfigurationException { + if (!pluginStore.strings.containsKey(attribute)) { + throw new AttributeNotFoundException(attribute); + } return pluginStore.strings.get(attribute); } @@ -63,6 +67,9 @@ public class PluginStoreConfigurationBackend implements ExtendedConfigurationBac */ @Override public Boolean getBooleanValue(String attribute) throws ConfigurationException { + if (!pluginStore.booleans.containsKey(attribute)) { + throw new AttributeNotFoundException(attribute); + } return pluginStore.booleans.get(attribute); } @@ -79,6 +86,9 @@ public class PluginStoreConfigurationBackend implements ExtendedConfigurationBac */ @Override public Double getDoubleValue(String attribute) throws ConfigurationException { + if (!pluginStore.strings.containsKey(attribute)) { + throw new AttributeNotFoundException(attribute); + } String stringValue = pluginStore.strings.get(attribute); if (stringValue == null) { return null; @@ -103,6 +113,9 @@ public class PluginStoreConfigurationBackend implements ExtendedConfigurationBac */ @Override public Integer getIntegerValue(String attribute) throws ConfigurationException { + if (!pluginStore.integers.containsKey(attribute)) { + throw new AttributeNotFoundException(attribute); + } return pluginStore.integers.get(attribute); } @@ -119,6 +132,9 @@ public class PluginStoreConfigurationBackend implements ExtendedConfigurationBac */ @Override public Long getLongValue(String attribute) throws ConfigurationException { + if (!pluginStore.longs.containsKey(attribute)) { + throw new AttributeNotFoundException(attribute); + } return pluginStore.longs.get(attribute); }