summaryrefslogtreecommitdiffstats
path: root/infra/translate-impl/src/main/java
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-11-22 16:59:39 +0100
committerMarek Gradzki <mgradzki@cisco.com>2017-11-22 16:59:44 +0100
commitf1c1e241b48997397616d9ac011647e2ac636397 (patch)
tree1e68c7b30d764dfb8eeff05bf164ba3855d82cce /infra/translate-impl/src/main/java
parent32c5f8d8e44298052e472bddd634a0fb684721f9 (diff)
Fix Sonar warnings in FlatWriterRegistry
Remove useless variables and simplify if conditions. Change-Id: I48a28334c47103057832f640c692c25625483bb6 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'infra/translate-impl/src/main/java')
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java13
1 files changed, 3 insertions, 10 deletions
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java
index d51ece23b..d8936850c 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java
@@ -194,8 +194,6 @@ final class FlatWriterRegistry implements WriterRegistry {
checkAllTypesCanBeHandled(updates);
LOG.debug("Performing bulk update for: {}", updates.keySet());
- DataObjectUpdate current = null;
-
// Iterate over all writers and call update if there are any related updates
for (InstanceIdentifier<?> writerType : writersOrder) {
Collection<? extends DataObjectUpdate> writersData = updates.get(writerType);
@@ -218,12 +216,11 @@ final class FlatWriterRegistry implements WriterRegistry {
LOG.trace("Performing update with writer: {}", writer);
for (DataObjectUpdate singleUpdate : writersData) {
- current = singleUpdate;
try {
writer.processModification(singleUpdate.getId(), singleUpdate.getDataBefore(),
singleUpdate.getDataAfter(), ctx);
} catch (Exception e) {
- throw new UpdateFailedException(e, alreadyProcessed, current);
+ throw new UpdateFailedException(e, alreadyProcessed, singleUpdate);
}
alreadyProcessed.add(singleUpdate);
LOG.trace("Update successful for type: {}", writerType);
@@ -238,13 +235,9 @@ final class FlatWriterRegistry implements WriterRegistry {
List<InstanceIdentifier<?>> noWriterNodes = new ArrayList<>();
for (InstanceIdentifier<?> id : updates.keySet()) {
// either there is direct writer for the iid
- if (writersById.containsKey(id)) {
- continue;
- } else {
- // or subtree one
- if (writers.stream().anyMatch(o -> o.canProcess(id))) {
+ // or subtree one
+ if (writersById.containsKey(id) || writers.stream().anyMatch(o -> o.canProcess(id))) {
continue;
- }
}
noWriterNodes.add(id);
}