Fix code smells (#447)

* fix sonar condition always true

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>

* remove useless assignment and useless private methods

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>

* fix unsafe usage of Optional.get

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>
This commit is contained in:
Michael Hirsch
2017-03-02 15:33:42 +01:00
committed by GitHub
parent 765b6170fb
commit 822c822948
5 changed files with 20 additions and 33 deletions

View File

@@ -109,16 +109,14 @@ public class AmqpMessageDispatcherService extends BaseAmqpService {
LOG.debug("targetAssignDistributionSet retrieved for controller {}. I will forward it to DMF broker.",
assignedEvent.getControllerId());
sendUpdateMessageToTarget(assignedEvent.getTenant(),
targetManagement.findTargetByControllerID(assignedEvent.getControllerId()).get(),
assignedEvent.getActionId(), assignedEvent.getModules());
targetManagement.findTargetByControllerID(assignedEvent.getControllerId()).ifPresent(target -> sendUpdateMessageToTarget(assignedEvent.getTenant(),
target,
assignedEvent.getActionId(), assignedEvent.getModules()));
}
void sendUpdateMessageToTarget(final String tenant, final Target target, final Long actionId,
final Collection<org.eclipse.hawkbit.repository.model.SoftwareModule> modules) {
if (target == null) {
return;
}
final URI targetAdress = target.getTargetInfo().getAddress();
if (!IpUtil.isAmqpUri(targetAdress)) {