Fix sonar warnings, enable code coverage
parent
1dd7c6edbb
commit
97225dd880
|
@ -1,5 +1,6 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'jacoco'
|
||||
id "com.github.hierynomus.license" version "0.15.0"
|
||||
id "org.sonarqube" version "2.7"
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public class ClingRegistryListener extends DefaultRegistryListener {
|
|||
try {
|
||||
return foundServices.poll(timeout, unit);
|
||||
} catch (final InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
logger.warn("Interrupted when waiting for a service");
|
||||
return null;
|
||||
}
|
||||
|
@ -65,7 +66,10 @@ public class ClingRegistryListener extends DefaultRegistryListener {
|
|||
}
|
||||
|
||||
logger.debug("Found connection service {}", connectionService);
|
||||
foundServices.offer(connectionService);
|
||||
final boolean success = foundServices.offer(connectionService);
|
||||
if (!success) {
|
||||
throw new IllegalStateException("Could not add new service");
|
||||
}
|
||||
}
|
||||
|
||||
protected Service<?, ?> discoverConnectionService(@SuppressWarnings("rawtypes") final Device<?, Device, ?> device) {
|
||||
|
|
|
@ -59,7 +59,7 @@ abstract class AbstractClingAction<T> implements ClingAction<T> {
|
|||
+ Arrays.toString(service.getActions()));
|
||||
}
|
||||
final ActionArgumentValue<RemoteService>[] argumentArray = getArguments(action);
|
||||
return new ActionInvocation<RemoteService>(action, argumentArray);
|
||||
return new ActionInvocation<>(action, argumentArray);
|
||||
}
|
||||
|
||||
private ActionArgumentValue<RemoteService>[] getArguments(final Action<RemoteService> action) {
|
||||
|
@ -77,7 +77,8 @@ abstract class AbstractClingAction<T> implements ClingAction<T> {
|
|||
}
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
final ActionArgumentValue<RemoteService>[] array = actionArgumentValues.toArray(new ActionArgumentValue[0]);
|
||||
final ActionArgumentValue<RemoteService>[] array = actionArgumentValues
|
||||
.toArray(new ActionArgumentValue[0]);
|
||||
return array;
|
||||
}
|
||||
}
|
|
@ -47,7 +47,7 @@ public class DummyRouter extends AbstractRouter {
|
|||
|
||||
@Override
|
||||
public void addPortMapping(final PortMapping mapping) {
|
||||
logger.debug("Adding mapping " + mapping);
|
||||
logger.debug("Adding mapping {}", mapping);
|
||||
mappings.add(mapping);
|
||||
}
|
||||
|
||||
|
@ -83,14 +83,14 @@ public class DummyRouter extends AbstractRouter {
|
|||
logger.debug("Sleep 3s to simulate delay when fetching port mappings.");
|
||||
Thread.sleep(3000);
|
||||
} catch (final InterruptedException e) {
|
||||
// ignore
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
return mappings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logRouterInfo() {
|
||||
logger.info("DummyRouter " + getName());
|
||||
logger.info("DummyRouter {}", getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue