Skip to content

Commit

Permalink
Spotbugs compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienlauer committed Dec 4, 2018
1 parent b0dcf8d commit a7d43a7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@

<properties>
<shed.version>1.1.4-SNAPSHOT</shed.version>

<testArgLine>-javaagent:${settings.localRepository}/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar</testArgLine>
<compatibility.version>3.0.0</compatibility.version>

<bintray.package>coffig</bintray.package>
</properties>

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/seedstack/coffig/mapper/ArrayMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package org.seedstack.coffig.mapper;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.lang.reflect.Array;
import java.lang.reflect.Type;
import java.util.Collection;
Expand All @@ -32,6 +33,7 @@ public boolean canHandle(Type type) {
}

@Override
@SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "Cast is verified in canHandle() method")
public Object map(TreeNode treeNode, Type type) {
Class componentType = ((Class) type).getComponentType();
Collection<TreeNode> values = treeNode.nodes().collect(Collectors.toList());
Expand All @@ -44,6 +46,7 @@ public Object map(TreeNode treeNode, Type type) {
}

@Override
@SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "Cast is verified in canHandle() method")
public TreeNode unmap(Object object, Type type) {
ArrayNode arrayNode = new ArrayNode();
Class componentType = ((Class) type).getComponentType();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/seedstack/coffig/mapper/BuilderMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import static org.seedstack.shed.reflect.Classes.instantiateDefault;
import static org.seedstack.shed.reflect.Types.rawClassOf;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
Expand Down Expand Up @@ -49,7 +50,7 @@ public Object map(TreeNode treeNode, Type type) {
try {
method.invoke(builder,
coffig.getMapper().map(namedNode.node(), method.getGenericParameterTypes()[0]));
} catch (Exception e) {
} catch (IllegalAccessException | InvocationTargetException e) {
throw ConfigurationException.wrap(e, ConfigurationErrorCode.ERROR_DURING_METHOD_INVOCATION)
.put("method", method.toString());
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/seedstack/coffig/mapper/EnumMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package org.seedstack.coffig.mapper;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.lang.reflect.Type;
import org.seedstack.coffig.TreeNode;
import org.seedstack.coffig.node.ValueNode;
Expand All @@ -21,6 +22,7 @@ public boolean canHandle(Type type) {

@SuppressWarnings("unchecked")
@Override
@SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "Cast is verified in canHandle() method")
public Object map(TreeNode treeNode, Type type) {
return Enum.valueOf((Class<Enum>) type, treeNode.value());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Object map(TreeNode treeNode, Type type) {
treeNode.namedNodes()
.forEach(namedNode -> properties.setProperty(namedNode.name(), namedNode.node().value()));
} else {
treeNode.nodes().forEach(item -> properties.setProperty(item.value(), null));
treeNode.nodes().forEach(item -> properties.setProperty(item.value(), ""));
}
return properties;
}
Expand Down

0 comments on commit a7d43a7

Please sign in to comment.