commit edf505ae06479b86a87e81ea0a2266a1cad2f7fc Author: Karsten Loesing karsten.loesing@gmx.net Date: Thu Nov 21 09:49:49 2019 +0100
Remove String[][] as configuration value type. --- .../metrics/collector/conf/Configuration.java | 24 ---------------------- .../metrics/collector/conf/ConfigurationTest.java | 7 ------- 2 files changed, 31 deletions(-)
diff --git a/src/main/java/org/torproject/metrics/collector/conf/Configuration.java b/src/main/java/org/torproject/metrics/collector/conf/Configuration.java index afda281..4bb581b 100644 --- a/src/main/java/org/torproject/metrics/collector/conf/Configuration.java +++ b/src/main/java/org/torproject/metrics/collector/conf/Configuration.java @@ -36,7 +36,6 @@ public class Configuration extends Observable implements Cloneable { Executors.newScheduledThreadPool(1);
public static final String FIELDSEP = ","; - public static final String ARRAYSEP = ";";
private final Properties props = new Properties(); private Path configurationFile; @@ -143,29 +142,6 @@ public class Configuration extends Observable implements Cloneable { }
/** - * Returns {@code String[][]} from a property. Commas seperate array elements - * and semicolons separate arrays, e.g., - * {@code propertyname = a1, a2, a3; b1, b2, b3} - */ - public String[][] getStringArrayArray(Key key) throws ConfigurationException { - try { - checkClass(key, String[][].class); - String[] interim = props.getProperty(key.name()).split(ARRAYSEP); - String[][] res = new String[interim.length][]; - for (int i = 0; i < interim.length; i++) { - res[i] = interim[i].trim().split(FIELDSEP); - for (int j = 0; j < res[i].length; j++) { - res[i][j] = res[i][j].trim(); - } - } - return res; - } catch (RuntimeException re) { - throw new ConfigurationException("Corrupt property: " + key - + " reason: " + re.getMessage(), re); - } - } - - /** * Returns {@code String[]} from a property. Commas seperate array elements, * e.g., * {@code propertyname = a1, a2, a3} diff --git a/src/test/java/org/torproject/metrics/collector/conf/ConfigurationTest.java b/src/test/java/org/torproject/metrics/collector/conf/ConfigurationTest.java index 887f3ae..e01aba2 100644 --- a/src/test/java/org/torproject/metrics/collector/conf/ConfigurationTest.java +++ b/src/test/java/org/torproject/metrics/collector/conf/ConfigurationTest.java @@ -148,13 +148,6 @@ public class ConfigurationTest { }
@Test(expected = ConfigurationException.class) - public void testArrayArrayValueException() throws Exception { - Configuration conf = new Configuration(); - conf.setProperty(Key.RelayCacheOrigins.name(), ""); - conf.getStringArrayArray(Key.OutputPath); - } - - @Test(expected = ConfigurationException.class) public void testPathValueException() throws Exception { Configuration conf = new Configuration(); conf.setProperty(Key.RelayLocalOrigins.name(), "\\u0000:");
tor-commits@lists.torproject.org