fixed sonar bugs
This commit is contained in:
@ -25,5 +25,12 @@
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@ -33,9 +33,11 @@ public class DefaultConfiguration<T, V extends T> implements Configuration<T, V>
|
||||
*
|
||||
* @return the map of parameters and values
|
||||
*/
|
||||
/*
|
||||
protected Map<Parameter<T>, V> getParameterMap() {
|
||||
return parameterMap;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* adds a new parameter to the configuration
|
||||
@ -95,9 +97,11 @@ public class DefaultConfiguration<T, V extends T> implements Configuration<T, V>
|
||||
* @throws ConfigurationException if the parameter is not defined
|
||||
*/
|
||||
public void setParameterValue (Map<Parameter<T>, V> map) throws ConfigurationException {
|
||||
for ( Parameter<T> key : map.keySet()) {
|
||||
for ( Map.Entry<Parameter<T>,V> entry : map.entrySet()) {
|
||||
Parameter<T> key = entry.getKey();
|
||||
V value = entry.getValue();
|
||||
if (parameterMap.containsKey(key)) {
|
||||
parameterMap.put (key, map.get(key));
|
||||
parameterMap.put (key, value);
|
||||
} else {
|
||||
throw new ConfigurationException("Parameter " + key.getName() + " not defined");
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package de.muehlencord.shared.configuration;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -9,6 +10,8 @@ import java.util.List;
|
||||
* @author jomu
|
||||
*/
|
||||
public abstract class Parameter<T> {
|
||||
|
||||
private final static Logger LOGGER = Logger.getLogger(Parameter.class);
|
||||
|
||||
/** the name of the parameter */
|
||||
private String name;
|
||||
@ -133,6 +136,7 @@ public abstract class Parameter<T> {
|
||||
validator.validate(value);
|
||||
return true;
|
||||
} catch (ValidationException ex) {
|
||||
LOGGER.debug (ex.toString(), ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@ package de.muehlencord.shared.configuration.validator;
|
||||
|
||||
import de.muehlencord.shared.configuration.ValidationException;
|
||||
import de.muehlencord.shared.configuration.Validator;
|
||||
import java.util.Arrays;
|
||||
import static java.util.Arrays.asList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
Reference in New Issue
Block a user