mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 11:45:49 +01:00
Fix NoEmptyLineSeparatorCheck and NewlineAtEndOfFileCheck SAT findings (#1108)
Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
parent
08a1f9a86d
commit
90005e4a56
@ -187,7 +187,6 @@ public class OAuthClientServiceImpl implements OAuthClientService {
|
||||
@Override
|
||||
public AccessTokenResponse getAccessTokenResponseByAuthorizationCode(String authorizationCode,
|
||||
@Nullable String redirectURI) throws OAuthException, IOException, OAuthResponseException {
|
||||
|
||||
if (isClosed()) {
|
||||
throw new OAuthException(EXCEPTION_MESSAGE_CLOSED);
|
||||
}
|
||||
@ -231,7 +230,6 @@ public class OAuthClientServiceImpl implements OAuthClientService {
|
||||
@Override
|
||||
public AccessTokenResponse getAccessTokenByResourceOwnerPasswordCredentials(String username, String password,
|
||||
@Nullable String scope) throws OAuthException, IOException, OAuthResponseException {
|
||||
|
||||
if (isClosed()) {
|
||||
throw new OAuthException(EXCEPTION_MESSAGE_CLOSED);
|
||||
}
|
||||
@ -253,7 +251,6 @@ public class OAuthClientServiceImpl implements OAuthClientService {
|
||||
@Override
|
||||
public AccessTokenResponse getAccessTokenByClientCredentials(@Nullable String scope)
|
||||
throws OAuthException, IOException, OAuthResponseException {
|
||||
|
||||
if (isClosed()) {
|
||||
throw new OAuthException(EXCEPTION_MESSAGE_CLOSED);
|
||||
}
|
||||
@ -278,7 +275,6 @@ public class OAuthClientServiceImpl implements OAuthClientService {
|
||||
|
||||
@Override
|
||||
public AccessTokenResponse refreshToken() throws OAuthException, IOException, OAuthResponseException {
|
||||
|
||||
if (isClosed()) {
|
||||
throw new OAuthException(EXCEPTION_MESSAGE_CLOSED);
|
||||
}
|
||||
@ -319,7 +315,6 @@ public class OAuthClientServiceImpl implements OAuthClientService {
|
||||
@Override
|
||||
public @Nullable AccessTokenResponse getAccessTokenResponse()
|
||||
throws OAuthException, IOException, OAuthResponseException {
|
||||
|
||||
if (isClosed()) {
|
||||
throw new OAuthException(EXCEPTION_MESSAGE_CLOSED);
|
||||
}
|
||||
@ -366,7 +361,6 @@ public class OAuthClientServiceImpl implements OAuthClientService {
|
||||
|
||||
@Override
|
||||
public void remove() throws OAuthException {
|
||||
|
||||
if (isClosed()) {
|
||||
throw new OAuthException(EXCEPTION_MESSAGE_CLOSED);
|
||||
}
|
||||
|
@ -138,7 +138,6 @@ public class OAuthConnector {
|
||||
public AccessTokenResponse grantTypePassword(String tokenUrl, String username, String password,
|
||||
@Nullable String clientId, @Nullable String clientSecret, @Nullable String scope, boolean supportsBasicAuth)
|
||||
throws OAuthResponseException, OAuthException, IOException {
|
||||
|
||||
HttpClient httpClient = null;
|
||||
try {
|
||||
httpClient = createHttpClient(tokenUrl);
|
||||
@ -173,7 +172,6 @@ public class OAuthConnector {
|
||||
public AccessTokenResponse grantTypeRefreshToken(String tokenUrl, String refreshToken, @Nullable String clientId,
|
||||
@Nullable String clientSecret, @Nullable String scope, boolean supportsBasicAuth)
|
||||
throws OAuthResponseException, OAuthException, IOException {
|
||||
|
||||
HttpClient httpClient = null;
|
||||
try {
|
||||
httpClient = createHttpClient(tokenUrl);
|
||||
@ -243,7 +241,6 @@ public class OAuthConnector {
|
||||
public AccessTokenResponse grantTypeClientCredentials(String tokenUrl, String clientId,
|
||||
@Nullable String clientSecret, @Nullable String scope, boolean supportsBasicAuth)
|
||||
throws OAuthResponseException, OAuthException, IOException {
|
||||
|
||||
HttpClient httpClient = null;
|
||||
try {
|
||||
httpClient = createHttpClient(tokenUrl);
|
||||
@ -295,7 +292,6 @@ public class OAuthConnector {
|
||||
|
||||
private AccessTokenResponse doRequest(final String grantType, HttpClient httpClient, final Request request,
|
||||
Fields fields) throws OAuthResponseException, OAuthException, IOException {
|
||||
|
||||
int statusCode = 0;
|
||||
String content = "";
|
||||
try {
|
||||
@ -342,7 +338,7 @@ public class OAuthConnector {
|
||||
|
||||
/**
|
||||
* This is a special case where the httpClient (jetty) is created due to the need for certificate pinning.
|
||||
* If ceritificate pinning is needed, please refer to {@code TrustManagerProvider}. The http client is
|
||||
* If certificate pinning is needed, please refer to {@code TrustManagerProvider}. The http client is
|
||||
* created, used and then shutdown immediately after use. There is little reason to cache the client/ connections
|
||||
* because oauth requests are short; and it may take hours/ days before the next request is needed.
|
||||
*
|
||||
|
@ -76,7 +76,6 @@ public class OAuthFactoryImpl implements OAuthFactory {
|
||||
oauthClientServiceCache.put(handle, clientImpl);
|
||||
}
|
||||
return clientImpl;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -67,7 +67,6 @@ class PersistedParams {
|
||||
this.scope = scope;
|
||||
this.supportsBasicAuth = supportsBasicAuth;
|
||||
this.tokenExpiresInSeconds = tokenExpiresInSeconds;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -165,4 +164,4 @@ class PersistedParams {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -171,4 +171,4 @@
|
||||
<operations public="true" package="true" protected="true" private="false" static="false"/>
|
||||
</classifier-display>
|
||||
<association-display labels="true" multiplicity="true"/>
|
||||
</class-diagram>
|
||||
</class-diagram>
|
||||
|
@ -102,7 +102,6 @@ public class ConnectionValidator {
|
||||
*/
|
||||
private static void validateActionConnections(ModuleTypeRegistry mtRegistry, Action action,
|
||||
@NonNull List<? extends @NonNull Trigger> triggers, @NonNull List<? extends @NonNull Action> actions) {
|
||||
|
||||
ActionType type = (ActionType) mtRegistry.get(action.getTypeUID()); // get module type of the condition
|
||||
if (type == null) {
|
||||
// if module type not exists in the system - throws exception
|
||||
@ -179,7 +178,6 @@ public class ConnectionValidator {
|
||||
*/
|
||||
private static void validateConditionConnections(ModuleTypeRegistry mtRegistry, @NonNull Condition condition,
|
||||
@NonNull List<? extends @NonNull Trigger> triggers) {
|
||||
|
||||
ConditionType type = (ConditionType) mtRegistry.get(condition.getTypeUID()); // get module type of the condition
|
||||
if (type == null) {
|
||||
// if module type not exists in the system - throws exception
|
||||
@ -225,7 +223,6 @@ public class ConnectionValidator {
|
||||
*/
|
||||
private static void checkConnection(ModuleTypeRegistry mtRegistry, Connection connection, Input input,
|
||||
@NonNull List<? extends @NonNull Trigger> triggers) {
|
||||
|
||||
Map<String, Trigger> triggersMap = new HashMap<>();
|
||||
for (Trigger trigger : triggers) {
|
||||
triggersMap.put(trigger.getId(), trigger);
|
||||
|
@ -59,7 +59,6 @@ public class TimeOfDayConditionHandler extends BaseConditionModuleHandler {
|
||||
|
||||
@Override
|
||||
public boolean isSatisfied(Map<String, Object> inputs) {
|
||||
|
||||
if (startTime == null || endTime == null) {
|
||||
logger.warn("Time condition with id {} is not well configured: startTime={} endTime = {}", module.getId(),
|
||||
startTime, endTime);
|
||||
|
@ -28,6 +28,9 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.smarthome.config.core.ConfigDescriptionParameter;
|
||||
import org.eclipse.smarthome.config.core.ConfigDescriptionParameter.Type;
|
||||
import org.eclipse.smarthome.config.core.ConfigDescriptionParameterBuilder;
|
||||
import org.eclipse.smarthome.config.core.Configuration;
|
||||
import org.eclipse.smarthome.config.core.ParameterOption;
|
||||
import org.openhab.core.automation.Action;
|
||||
import org.openhab.core.automation.annotation.ActionInput;
|
||||
import org.openhab.core.automation.annotation.ActionOutput;
|
||||
@ -37,9 +40,6 @@ import org.openhab.core.automation.annotation.RuleAction;
|
||||
import org.openhab.core.automation.type.ActionType;
|
||||
import org.openhab.core.automation.type.Input;
|
||||
import org.openhab.core.automation.type.Output;
|
||||
import org.eclipse.smarthome.config.core.ConfigDescriptionParameterBuilder;
|
||||
import org.eclipse.smarthome.config.core.Configuration;
|
||||
import org.eclipse.smarthome.config.core.ParameterOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -218,7 +218,6 @@ public class AnnotationActionModuleTypeHelper {
|
||||
if (mis.size() == 1 && config == null) {
|
||||
finalMI = (ModuleInformation) mis.toArray()[0];
|
||||
} else {
|
||||
|
||||
for (ModuleInformation mi : mis) {
|
||||
if (thing) {
|
||||
if (Objects.equals(mi.getThingUID(), config)) {
|
||||
|
@ -66,6 +66,5 @@ public class OpenHAB {
|
||||
// ignore if the file is not there or not readable
|
||||
}
|
||||
return "Unknown Build No.";
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -99,12 +99,9 @@ public class DefaultSitemapProvider implements SitemapProvider {
|
||||
if (!thingFrame.getChildren().isEmpty()) {
|
||||
sitemap.getChildren().add(thingFrame);
|
||||
}
|
||||
|
||||
return sitemap;
|
||||
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -159,4 +159,4 @@ public abstract class AbstractActiveBinding<P extends BindingProvider> extends A
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,6 @@ public class BindingConfigReaderDelegate implements BindingConfigReader {
|
||||
|
||||
private org.openhab.core.items.Item getOpenHABItem(String itemType, String itemName)
|
||||
throws BindingConfigParseException {
|
||||
|
||||
String mainType = ItemUtil.getMainItemType(itemType);
|
||||
|
||||
switch (mainType) {
|
||||
|
@ -70,9 +70,7 @@ public class EventBridge implements EventHandler, EventSubscriber {
|
||||
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
|
||||
if (!Boolean.TRUE.equals(event.getProperty(BRIDGEMARKER))) {
|
||||
|
||||
// map event from openHAB to ESH
|
||||
if (event.getTopic().startsWith(org.openhab.core.events.EventConstants.TOPIC_PREFIX)) {
|
||||
if (event.getTopic().endsWith(EventType.COMMAND.name())) {
|
||||
|
@ -87,4 +87,4 @@ public interface Item {
|
||||
* @return list of item group names
|
||||
*/
|
||||
public List<String> getGroupNames();
|
||||
}
|
||||
}
|
||||
|
@ -58,11 +58,9 @@ public class LocationItem extends GenericItem {
|
||||
* @return distance between the two points in meters
|
||||
*/
|
||||
public DecimalType distanceFrom(PointType away) {
|
||||
|
||||
double dist = -1;
|
||||
|
||||
if ((away != null) && (this.state instanceof PointType)) {
|
||||
|
||||
PointType me = (PointType) this.state;
|
||||
|
||||
double dLat = Math.pow(
|
||||
|
@ -239,4 +239,4 @@ public class PointType implements ComplexType, Command, State {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +184,6 @@ public abstract class AbstractActiveService {
|
||||
* @param refreshInterval
|
||||
*/
|
||||
protected void pause(long refreshInterval) {
|
||||
|
||||
try {
|
||||
Thread.sleep(refreshInterval);
|
||||
} catch (InterruptedException e) {
|
||||
@ -194,4 +193,4 @@ public abstract class AbstractActiveService {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,6 @@ public class HttpUtil {
|
||||
*/
|
||||
public static String executeUrl(String httpMethod, String url, InputStream content, String contentType,
|
||||
int timeout) {
|
||||
|
||||
return executeUrl(httpMethod, url, null, content, contentType, timeout);
|
||||
}
|
||||
|
||||
@ -132,7 +131,6 @@ public class HttpUtil {
|
||||
|
||||
return executeUrl(httpMethod, url, httpHeaders, content, contentType, timeout, proxyHost, proxyPort, proxyUser,
|
||||
proxyPassword, nonProxyHosts);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,7 +153,6 @@ public class HttpUtil {
|
||||
public static String executeUrl(String httpMethod, String url, Properties httpHeaders, InputStream content,
|
||||
String contentType, int timeout, String proxyHost, Integer proxyPort, String proxyUser,
|
||||
String proxyPassword, String nonProxyHosts) {
|
||||
|
||||
HttpClient client = new HttpClient();
|
||||
|
||||
// only configure a proxy if a host is provided
|
||||
@ -196,7 +193,6 @@ public class HttpUtil {
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
int statusCode = client.executeMethod(method);
|
||||
if (statusCode != HttpStatus.SC_OK) {
|
||||
LOGGER.debug("Method failed: {}", method.getStatusLine());
|
||||
@ -231,7 +227,6 @@ public class HttpUtil {
|
||||
* otherwise
|
||||
*/
|
||||
private static boolean shouldUseProxy(String urlString, String nonProxyHosts) {
|
||||
|
||||
if (StringUtils.isNotBlank(nonProxyHosts)) {
|
||||
String givenHost = urlString;
|
||||
|
||||
@ -277,11 +272,9 @@ public class HttpUtil {
|
||||
* <code>url</code> does not contain credentials
|
||||
*/
|
||||
protected static Credentials extractCredentials(String url) {
|
||||
|
||||
Matcher matcher = URL_CREDENTIALS_PATTERN.matcher(url);
|
||||
|
||||
if (matcher.matches()) {
|
||||
|
||||
matcher.reset();
|
||||
|
||||
String username = "";
|
||||
@ -312,7 +305,6 @@ public class HttpUtil {
|
||||
* <code>GET</code>, <code>PUT</code>, <code>POST</POST> or <code>DELETE</code>
|
||||
*/
|
||||
public static HttpMethod createHttpMethod(String httpMethodString, String url) {
|
||||
|
||||
if ("GET".equals(httpMethodString)) {
|
||||
return new GetMethod(url);
|
||||
} else if ("PUT".equals(httpMethodString)) {
|
||||
|
@ -134,4 +134,4 @@ public abstract class AbstractGenericBindingProvider implements BindingConfigRea
|
||||
return new ArrayList<>(bindingConfigs.keySet());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -245,7 +245,6 @@ public class UpnpDiscoveryService extends AbstractDiscoveryService
|
||||
logger.error("Could not restart UPnP network components.", e);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -193,6 +193,5 @@ public class UsbSerialDiscoveryService extends AbstractDiscoveryService implemen
|
||||
return DiscoveryResultBuilder.create(result.getThingUID()).withProperties(resultProperties)
|
||||
.withBridge(result.getBridgeUID()).withTTL(result.getTimeToLive()).withLabel(result.getLabel())
|
||||
.withRepresentationProperty(result.getRepresentationProperty()).build();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,6 @@ public class SendConsoleCommandExtension extends AbstractConsoleCommandExtension
|
||||
} else {
|
||||
printUsage(console);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -46,4 +46,4 @@ class BundleHttpContext extends DelegatingHttpContext {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -204,7 +204,6 @@ public class CertificateGenerator implements BundleActivator {
|
||||
logger.debug("Save the keystore into {}.", keystoreFile.getAbsolutePath());
|
||||
|
||||
keystore.store(new FileOutputStream(keystoreFile), KEYSTORE_PASSWORD.toCharArray());
|
||||
|
||||
} catch (NoSuchAlgorithmException | InvalidKeySpecException | IOException | OperatorCreationException
|
||||
| InvalidAlgorithmParameterException e) {
|
||||
throw new CertificateException("Failed to generate the new certificate.", e);
|
||||
|
@ -542,7 +542,6 @@ public class ItemResource implements RESTResource {
|
||||
public Response addMetadata(@PathParam("itemname") @ApiParam(value = "item name", required = true) String itemname,
|
||||
@PathParam("namespace") @ApiParam(value = "namespace", required = true) String namespace,
|
||||
@ApiParam(value = "metadata", required = true) MetadataDTO metadata) {
|
||||
|
||||
Item item = getItem(itemname);
|
||||
|
||||
if (item == null) {
|
||||
@ -579,7 +578,6 @@ public class ItemResource implements RESTResource {
|
||||
public Response removeMetadata(
|
||||
@PathParam("itemname") @ApiParam(value = "item name", required = true) String itemname,
|
||||
@PathParam("namespace") @ApiParam(value = "namespace", required = true) String namespace) {
|
||||
|
||||
Item item = getItem(itemname);
|
||||
|
||||
if (item == null) {
|
||||
|
@ -100,7 +100,6 @@ public class ItemChannelLinkResource implements RESTResource {
|
||||
@ApiResponse(code = 404, message = "Content does not match the path") })
|
||||
public Response getLink(@PathParam("itemName") @ApiParam(value = "itemName") String itemName,
|
||||
@PathParam("channelUID") @ApiParam(value = "channelUID") String channelUid) {
|
||||
|
||||
List<ItemChannelLinkDTO> links = itemChannelLinkRegistry.getAll().stream()
|
||||
.filter(link -> channelUid.equals(link.getLinkedUID().getAsString()))
|
||||
.filter(link -> itemName.equals(link.getItemName())).map(this::toBeans).collect(Collectors.toList());
|
||||
|
@ -840,4 +840,4 @@ public class SitemapResource implements RESTResource, SitemapSubscriptionCallbac
|
||||
return itemUIRegistry != null && subscriptions != null && localeService != null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -538,7 +538,6 @@ public class MqttBrokerConnection {
|
||||
*/
|
||||
@SuppressWarnings({ "null", "unused" })
|
||||
public CompletableFuture<Boolean> unsubscribe(String topic, MqttMessageSubscriber subscriber) {
|
||||
|
||||
synchronized (subscribers) {
|
||||
final @Nullable List<MqttMessageSubscriber> list = subscribers.get(topic);
|
||||
if (list == null) {
|
||||
|
@ -53,7 +53,6 @@ public class JavaCommPortProvider implements SerialPortProvider {
|
||||
return null;
|
||||
}
|
||||
return new SerialPortIdentifierImpl(ident);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,7 +104,6 @@ public class SerialPortUtil {
|
||||
}
|
||||
|
||||
static @Nullable String initSerialPort(String port, @Nullable String serialPortsProperty) {
|
||||
|
||||
String pathSeparator = File.pathSeparator;
|
||||
Set<String> serialPorts = null;
|
||||
if (serialPortsProperty != null) {
|
||||
|
@ -375,7 +375,6 @@ public class FeatureInstaller implements ConfigurationListener {
|
||||
}
|
||||
|
||||
private synchronized void installAddons(final FeaturesService service, final Map<String, Object> config) {
|
||||
|
||||
final Set<String> currentAddons = new HashSet<>(); // the currently installed ones
|
||||
final Set<String> targetAddons = new HashSet<>(); // the target we want to have installed afterwards
|
||||
final Set<String> installAddons = new HashSet<>(); // the ones to be installed (the diff)
|
||||
|
@ -69,7 +69,6 @@ public class InstallServiceCommand implements Action {
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("Starting openHAB system service installation...");
|
||||
System.out.println("");
|
||||
@ -224,7 +223,6 @@ public class InstallServiceCommand implements Action {
|
||||
* wrapper service file
|
||||
*/
|
||||
private void printPostInstallStepsRedHat(File serviceFile) {
|
||||
|
||||
System.out.println(INTENSITY_BOLD + "RedHat/Fedora/CentOS Linux system detected (SystemV):" + INTENSITY_NORMAL);
|
||||
System.out.println(" To install the service:");
|
||||
System.out.println(" $ ln -s " + serviceFile.getPath() + " /etc/init.d/");
|
||||
@ -245,7 +243,6 @@ public class InstallServiceCommand implements Action {
|
||||
System.out.println(" To uninstall the service :");
|
||||
System.out.println(" $ chkconfig " + serviceFile.getName() + " --del");
|
||||
System.out.println(" $ rm /etc/init.d/" + serviceFile.getPath());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -256,7 +253,6 @@ public class InstallServiceCommand implements Action {
|
||||
* wrapper service file
|
||||
*/
|
||||
private void printPostInstallStepsDebian(File serviceFile) {
|
||||
|
||||
System.out.println(INTENSITY_BOLD + "Ubuntu/Debian Linux system detected (SystemV):" + INTENSITY_NORMAL);
|
||||
System.out.println(" To install the service:");
|
||||
System.out.println(" $ ln -s " + serviceFile.getPath() + " /etc/init.d/");
|
||||
@ -275,7 +271,6 @@ public class InstallServiceCommand implements Action {
|
||||
System.out.println("");
|
||||
System.out.println(" To uninstall the service :");
|
||||
System.out.println(" $ rm /etc/init.d/" + serviceFile.getName());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -286,7 +281,6 @@ public class InstallServiceCommand implements Action {
|
||||
* systemd file
|
||||
*/
|
||||
private void printPostInstallStepsSystemd(File systemdFile) {
|
||||
|
||||
System.out.println(INTENSITY_BOLD + "For systemd compliant Linux: " + INTENSITY_NORMAL);
|
||||
System.out.println(" To install the service (and enable at system boot):");
|
||||
System.out.println(" $ systemctl enable " + systemdFile.getPath());
|
||||
@ -305,7 +299,6 @@ public class InstallServiceCommand implements Action {
|
||||
System.out.println("");
|
||||
System.out.println(" To uninstall the service (and disable at system boot):");
|
||||
System.out.println(" $ systemctl disable " + SERVICE_NAME);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -316,7 +309,6 @@ public class InstallServiceCommand implements Action {
|
||||
* wrapper service file
|
||||
*/
|
||||
private void printPostInstallStepsWindows(File serviceFile) {
|
||||
|
||||
System.out.println(INTENSITY_BOLD + "MS Windows system detected:" + INTENSITY_NORMAL);
|
||||
System.out.println("To install the service, run: ");
|
||||
System.out.println(" C:> " + serviceFile.getPath() + " install");
|
||||
@ -329,7 +321,6 @@ public class InstallServiceCommand implements Action {
|
||||
System.out.println("");
|
||||
System.out.println("Once stopped, to remove the installed the service run: ");
|
||||
System.out.println(" C:> " + serviceFile.getPath() + " remove");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -340,7 +331,6 @@ public class InstallServiceCommand implements Action {
|
||||
* openHAB pList file
|
||||
*/
|
||||
private void printPostInstallStepsOsX(File serviceFile) {
|
||||
|
||||
System.out.println(INTENSITY_BOLD + "Mac OS X system detected:" + INTENSITY_NORMAL);
|
||||
System.out.println("");
|
||||
System.out.println("To configure openHAB as a " + INTENSITY_BOLD + "user service" + INTENSITY_NORMAL
|
||||
@ -363,7 +353,6 @@ public class InstallServiceCommand implements Action {
|
||||
System.out.println("");
|
||||
System.out.println("For removing the service call:");
|
||||
System.out.println("> launchctl remove openHAB");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -373,7 +362,6 @@ public class InstallServiceCommand implements Action {
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
private File createOpenHabPList() throws FileNotFoundException {
|
||||
|
||||
// tweak plist file
|
||||
String plistPath = System.getProperty("karaf.home") + "/bin/";
|
||||
File karafPlist = new File(plistPath + "org.apache.karaf.openHAB.plist");
|
||||
@ -434,4 +422,4 @@ public class InstallServiceCommand implements Action {
|
||||
logger.error("Error closing outputstream", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,6 @@ public class MagicChattyThingHandler extends BaseThingHandler {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,7 +60,6 @@ public class MagicSingleActionService implements AnnotatedActions {
|
||||
public @ActionOutput(name = "output1", type = "java.lang.Integer") @ActionOutput(name = "output2", type = "java.lang.String") Map<String, Object> singleServiceAction(
|
||||
@ActionInput(name = "input1") String input1, @ActionInput(name = "input2") String input2, String input3,
|
||||
@ActionInput(name = "someNameForInput4") String input4) {
|
||||
|
||||
// do some calculation stuff here and place the outputs into the result map
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("output1", 42);
|
||||
|
@ -41,7 +41,6 @@ public class MagicThingActionsService implements ThingActions {
|
||||
@RuleAction(label = "Magic thingHandlerAction", description = "Action that calls some logic in a thing handler")
|
||||
public @ActionOutput(name = "output1", type = "java.lang.String") @ActionOutput(name = "output2", type = "java.lang.String") Map<String, Object> thingHandlerAction(
|
||||
@ActionInput(name = "input1") String input1, @ActionInput(name = "input2") String input2) {
|
||||
|
||||
logger.debug("thingHandlerAction called with inputs: {} {}", input1, input2);
|
||||
|
||||
// one can pass any data to the handler of the selected thing, here we are passing the first input parameter
|
||||
|
@ -93,7 +93,6 @@ public class TestServer {
|
||||
serverStarted.completeExceptionally(e);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -47,7 +47,6 @@ public class CommandDescriptionConverter extends GenericUnmarshaller<CommandDesc
|
||||
NodeList commandOptionsNode = (NodeList) nodeIterator.next();
|
||||
if (commandOptionsNode != null) {
|
||||
if ("options".equals(commandOptionsNode.getNodeName())) {
|
||||
|
||||
CommandDescriptionBuilder commandDescriptionBuilder = CommandDescriptionBuilder.create();
|
||||
for (Object coNodeObject : commandOptionsNode.getList()) {
|
||||
NodeValue optionsNode = (NodeValue) coNodeObject;
|
||||
|
@ -264,7 +264,6 @@ public final class FirmwareImpl implements Firmware {
|
||||
}
|
||||
|
||||
private int compare(@Nullable Version theVersion) {
|
||||
|
||||
if (theVersion == null) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ abstract class AbstractChannelTypeBuilder<T extends ChannelTypeBuilder<T>> imple
|
||||
protected @Nullable URI configDescriptionURI;
|
||||
|
||||
public AbstractChannelTypeBuilder(ChannelTypeUID channelTypeUID, String label) {
|
||||
|
||||
if (channelTypeUID == null) {
|
||||
throw new IllegalArgumentException("ChannelTypeUID must be set.");
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ public class ChannelGroupTypeBuilder {
|
||||
* @return ChannelGroupTypeBuilder for {@link ChannelGroupType}s
|
||||
*/
|
||||
public static ChannelGroupTypeBuilder instance(ChannelGroupTypeUID channelGroupTypeUID, String label) {
|
||||
|
||||
if (channelGroupTypeUID == null) {
|
||||
throw new IllegalArgumentException("ChannelGroupTypeUID must be set.");
|
||||
}
|
||||
|
@ -330,7 +330,6 @@ public class ProxyServletService extends HttpServlet {
|
||||
* @return true if the request is relative to a video widget
|
||||
*/
|
||||
boolean proxyingVideoWidget(HttpServletRequest request) {
|
||||
|
||||
boolean proxyingVideo = false;
|
||||
|
||||
try {
|
||||
|
@ -318,7 +318,6 @@ public abstract class AbstractRuleBasedInterpreter implements HumanLanguageInter
|
||||
return InterpretationResult.SEMANTIC_ERROR;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -173,7 +173,6 @@ public class ThreadFactoryBuilder {
|
||||
private static ThreadFactory build(ThreadFactory wrappedThreadFactory, @Nullable String namePrefix,
|
||||
@Nullable String name, boolean daemonThreads, @Nullable UncaughtExceptionHandler uncaughtExceptionHandler,
|
||||
@Nullable Integer priority) {
|
||||
|
||||
return new ThreadFactory() {
|
||||
AtomicInteger threadCounter = new AtomicInteger(1);
|
||||
|
||||
|
@ -465,7 +465,6 @@ class CronAdjuster implements SchedulerTemporalAdjuster {
|
||||
|
||||
@Override
|
||||
public Temporal adjustInto(@Nullable Temporal temporal) {
|
||||
|
||||
// Never match the actual time, so since our basic
|
||||
// unit is seconds, we add one second.
|
||||
Temporal ret = temporal.plus(1, ChronoUnit.SECONDS);
|
||||
|
@ -140,7 +140,6 @@ public class SchedulerImpl implements Scheduler {
|
||||
@Override
|
||||
public <T> ScheduledCompletableFuture<T> schedule(SchedulerRunnable runnable,
|
||||
SchedulerTemporalAdjuster temporalAdjuster) {
|
||||
|
||||
final ScheduledCompletableFutureRecurring<T> schedule = new ScheduledCompletableFutureRecurring<T>();
|
||||
|
||||
schedule(schedule, runnable, temporalAdjuster);
|
||||
|
@ -557,7 +557,6 @@ public class NetUtil implements NetworkAddressService {
|
||||
}
|
||||
|
||||
private void scheduleToPollNetworkInterface(int intervalInSeconds) {
|
||||
|
||||
if (networkInterfacePollFuture != null) {
|
||||
networkInterfacePollFuture.cancel(true);
|
||||
networkInterfacePollFuture = null;
|
||||
|
@ -29,4 +29,4 @@ public interface ScheduledCompletableFuture<T> extends ScheduledFuture<T> {
|
||||
* @return Returns the {@link CompletableFuture} associated with the scheduled job.
|
||||
*/
|
||||
CompletableFuture<T> getPromise();
|
||||
}
|
||||
}
|
||||
|
@ -34,4 +34,4 @@ public interface SchedulerTemporalAdjuster extends TemporalAdjuster {
|
||||
* @return true if running is done and the job should not run anymore.
|
||||
*/
|
||||
boolean isDone(Temporal temporal);
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,6 @@ public class UnitUtils {
|
||||
for (Class<? extends SystemOfUnits> system : ALL_SYSTEM_OF_UNITS) {
|
||||
for (Field field : system.getDeclaredFields()) {
|
||||
if (field.getType().isAssignableFrom(Unit.class) && Modifier.isStatic(field.getModifiers())) {
|
||||
|
||||
Type genericType = field.getGenericType();
|
||||
if (genericType instanceof ParameterizedType) {
|
||||
String dimension = ((Class<?>) ((ParameterizedType) genericType).getActualTypeArguments()[0])
|
||||
|
@ -47,7 +47,6 @@ public class CipherTest {
|
||||
|
||||
@Test
|
||||
public void testEncDec() throws GeneralSecurityException {
|
||||
|
||||
String cipherText = spySymmetricKeyCipher.encrypt(PLAIN_TEXT);
|
||||
assertNotNull("Cipher text should not be null", cipherText);
|
||||
assertNotEquals("Cipher text should not be the same as plaintext", PLAIN_TEXT, cipherText);
|
||||
|
@ -100,7 +100,7 @@ public class AutomationIntegrationJsonTest extends JavaOSGiTest {
|
||||
|
||||
@Override
|
||||
public Collection<Item> getAll() {
|
||||
HashSet<Item> items = new HashSet<>();
|
||||
Set<Item> items = new HashSet<>();
|
||||
items.add(new SwitchItem("myMotionItem"));
|
||||
items.add(new SwitchItem("myPresenceItem"));
|
||||
items.add(new SwitchItem("myLampItem"));
|
||||
@ -167,7 +167,6 @@ public class AutomationIntegrationJsonTest extends JavaOSGiTest {
|
||||
assertThat(moduleTypeRegistry, is(notNullValue()));
|
||||
}, 9000, 1000);
|
||||
logger.info("@Before.finish");
|
||||
|
||||
}
|
||||
|
||||
@After
|
||||
@ -218,7 +217,6 @@ public class AutomationIntegrationJsonTest extends JavaOSGiTest {
|
||||
assertThat(output3.isPresent(), is(true));
|
||||
assertThat(output3.get().getDefaultValue(), is("{\"command\":\"OFF\"}"));
|
||||
}, 10000, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -384,4 +382,4 @@ public class AutomationIntegrationJsonTest extends JavaOSGiTest {
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +217,6 @@ public class HostFragmentSupportTest extends JavaOSGiTest {
|
||||
assertThat(moduleTypeRegistry.get(condition1), is(nullValue()));
|
||||
assertThat(moduleTypeRegistry.get(action1), is(nullValue()));
|
||||
}, 3000, 200);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("null")
|
||||
@ -404,4 +403,4 @@ public class HostFragmentSupportTest extends JavaOSGiTest {
|
||||
}, 3000, 200);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -195,6 +195,5 @@ public class RunRuleModuleTest extends JavaOSGiTest {
|
||||
assertEquals("smarthome/items/switch3/command", event.getTopic());
|
||||
assertEquals(OnOffType.ON, event.getItemCommand());
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,6 @@ public abstract class BasicConditionHandlerTest extends JavaOSGiTest {
|
||||
|
||||
@Test
|
||||
public void assertThatConditionWorksInRule() throws ItemNotFoundException {
|
||||
|
||||
String testItemName1 = "TriggeredItem";
|
||||
String testItemName2 = "SwitchedItem";
|
||||
|
||||
|
@ -119,4 +119,4 @@ public class TimeOfDayConditionHandlerTest extends BasicConditionHandlerTest {
|
||||
assertThat(mtr.get(DayOfWeekConditionHandler.MODULE_TYPE_ID), is(notNullValue()));
|
||||
}, 3000, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,6 @@ public class RuleEventTest extends JavaOSGiTest {
|
||||
|
||||
@Test
|
||||
public void testRuleEvents() throws ItemNotFoundException {
|
||||
|
||||
// Registering eventSubscriber
|
||||
List<Event> ruleEvents = new ArrayList<>();
|
||||
|
||||
@ -235,4 +234,4 @@ public class RuleEventTest extends JavaOSGiTest {
|
||||
assertThat(ruleRemovedEvent.getTopic(), is(equalTo("smarthome/rules/myRule21/removed")));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,6 @@ public class RuleEngineTest extends JavaOSGiTest {
|
||||
"triggerId.out3", actionInputs.get("in5"));
|
||||
Assert.assertEquals("Auto map action input in5[tagD, tagE] to action output out5[tagD, tagE]", "actionId.out5",
|
||||
actionInputs.get("in4"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -284,7 +284,6 @@ public class RuleRegistryTest extends JavaOSGiTest {
|
||||
ruleRegistry.stream().filter(hasAllTags(tags)).collect(Collectors.toList()).size());
|
||||
Assert.assertEquals("RuleImpl list size", 1,
|
||||
ruleRegistry.stream().filter(hasAllTags(tag1, tag2, tag3)).collect(Collectors.toList()).size());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,6 @@ public class BindingInstaller {
|
||||
// Wait for correctly uninstalled bundle.
|
||||
waitForAssert.accept(
|
||||
() -> assertThat(bindingInfoRegistry.getBindingInfos().size(), is(initialNumberOfBindingInfos)));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -315,7 +315,6 @@ public class DiscoveryServiceRegistryOSGiTest extends JavaOSGiTest {
|
||||
assertThat(inbox.getAll().size(), is(2));
|
||||
assertThat(inbox.getAll().stream().filter(r -> BRIDGE_UID_1.equals(r.getBridgeUID())).count(), is(1L));
|
||||
assertThat(inbox.getAll().stream().filter(r -> BRIDGE_UID_2.equals(r.getBridgeUID())).count(), is(1L));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1073,4 +1073,4 @@ public class InboxOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -197,7 +197,6 @@ public class ItemResourceOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@Test
|
||||
public void addMultipleItems() throws IOException {
|
||||
|
||||
List<GroupItemDTO> itemList = new ArrayList<>();
|
||||
GroupItemDTO[] items = new GroupItemDTO[] {};
|
||||
|
||||
|
@ -192,7 +192,6 @@ public class GenericItemChannelLinkProviderJavaTest extends JavaOSGiTest {
|
||||
assertEquals("bar", link.getConfiguration().get("foo"));
|
||||
assertEquals(new BigDecimal(42), link.getConfiguration().get("answer"));
|
||||
assertEquals(true, link.getConfiguration().get("always"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -225,7 +224,6 @@ public class GenericItemChannelLinkProviderJavaTest extends JavaOSGiTest {
|
||||
.getConfiguration().get("value"));
|
||||
assertEquals(new BigDecimal(2), itemChannelLinkRegistry.get("Light3Color -> hue:LCT001:huebridge:bulb4:color")
|
||||
.getConfiguration().get("value"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -230,7 +230,6 @@ public class GenericThingProviderTest extends JavaOSGiTest {
|
||||
|
||||
@Test
|
||||
public void assertThatThingIdCanContainAllCharactersAllowedInConfigDescriptionXSD() {
|
||||
|
||||
Collection<Thing> things = thingRegistry.getAll();
|
||||
assertThat(things.size(), is(0));
|
||||
|
||||
|
@ -80,7 +80,6 @@ public class TestHueChannelTypeProvider implements ChannelTypeProvider, ChannelG
|
||||
.build()))
|
||||
.build();
|
||||
channelGroupTypes = Arrays.asList(groupX);
|
||||
|
||||
} catch (Exception willNeverBeThrown) {
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,6 @@ public class TestHueThingHandlerFactory extends BaseThingHandlerFactory {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,6 @@ public class TestHueThingHandlerFactoryX extends BaseThingHandlerFactory impleme
|
||||
public static final String LIGHT_ID = "XlightId";
|
||||
|
||||
public TestHueThingHandlerFactoryX(ComponentContext componentContext) {
|
||||
|
||||
super.activate(componentContext);
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,6 @@ public class TestHueThingTypeProvider implements ThingTypeProvider {
|
||||
.withSupportedBridgeTypeUIDs(Arrays.asList(TestHueThingHandlerFactory.THING_TYPE_BRIDGE.toString()))
|
||||
.withDescription("Grouped Lamp").withChannelGroupDefinitions(Arrays.asList(groupDefinition))
|
||||
.withConfigDescriptionURI(new URI("hue", "grouped", null)).build());
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("{}", e.getMessage());
|
||||
}
|
||||
|
@ -188,7 +188,6 @@ public class OSGiEventManagerOSGiTest extends JavaOSGiTest {
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertEquals("Argument 'event' must not be null.", e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -69,7 +69,6 @@ public class TranslationProviderOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@Test
|
||||
public void assertThatGetTextWithoutBundleIsWorkingProperly() {
|
||||
|
||||
String text = translationProvider.getText(null, null, null, null);
|
||||
assertThat(text, is(nullValue()));
|
||||
|
||||
|
@ -113,4 +113,4 @@ public class ItemUpdaterOSGiTest extends JavaOSGiTest {
|
||||
// make sure no state changed event has been sent
|
||||
assertTrue(receivedEvents.isEmpty());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,6 @@ public class ItemRegistryImplTest extends JavaTest {
|
||||
List<String> itemNames = items.stream().map(i -> i.getName()).collect(toList());
|
||||
assertThat(itemNames, hasItem(CAMERA_ITEM_NAME1));
|
||||
assertThat(itemNames, hasItem(CAMERA_ITEM_NAME2));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -433,7 +433,6 @@ public class BindingBaseClassesOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
|
||||
}
|
||||
|
||||
public void updateConfig() {
|
||||
|
@ -215,4 +215,4 @@ public class ThingLinkManagerOSGiTest extends JavaOSGiTest {
|
||||
context.put("unlinkedChannel", channelUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2010,4 +2010,4 @@ public class ThingManagerOSGiTest extends JavaOSGiTest {
|
||||
registerService(configDescriptionProvider);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -419,4 +419,4 @@ public class FirmwareRegistryOSGiTest extends JavaOSGiTest {
|
||||
assertThat(firmwares.get(FW1), is(FW112_EN));
|
||||
assertThat(firmwares.get(FW2), is(FW111_EN));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -837,7 +837,6 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
|
||||
@Test
|
||||
public void testBackgroundTransfer() throws Exception {
|
||||
|
||||
Map<String, String> props = new HashMap<>();
|
||||
props.put(Thing.PROPERTY_FIRMWARE_VERSION, V111);
|
||||
props.put(Thing.PROPERTY_VENDOR, VENDOR1);
|
||||
|
@ -55,47 +55,38 @@ public class AudioManagerStub implements AudioManager {
|
||||
|
||||
@Override
|
||||
public void play(AudioStream audioStream) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void play(AudioStream audioStream, String sinkId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void play(AudioStream audioStream, String sinkId, PercentType volume) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playFile(String fileName) throws AudioException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playFile(String fileName, PercentType volume) throws AudioException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playFile(String fileName, String sinkId) throws AudioException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playFile(String fileName, String sinkId, PercentType volume) throws AudioException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stream(String url) throws AudioException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stream(String url, String sinkId) throws AudioException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,7 +96,6 @@ public class AudioManagerStub implements AudioManager {
|
||||
|
||||
@Override
|
||||
public void setVolume(PercentType volume, String sinkId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,7 +70,6 @@ public class KSServiceStub implements KSService {
|
||||
@Override
|
||||
public KSServiceHandle spot(KSListener ksListener, AudioStream audioStream, Locale locale, String keyword)
|
||||
throws KSException {
|
||||
|
||||
if (isKSExceptionExpected) {
|
||||
throw new KSException("Expected KSException");
|
||||
} else {
|
||||
|
@ -50,7 +50,6 @@ public class TTSServiceStub implements TTSService {
|
||||
}
|
||||
|
||||
public TTSServiceStub() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user