[tr064] log warning if config invalid (#9529)

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K 2020-12-30 15:57:50 +01:00 committed by GitHub
parent ee93229d3c
commit 883b251626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -12,7 +12,6 @@
*/
package org.openhab.binding.tr064.internal.config;
import java.util.Collections;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
@ -27,7 +26,7 @@ public class Tr064SubConfiguration extends Tr064BaseThingConfiguration {
public String uuid = "";
// Lan Device
public List<String> macOnline = Collections.emptyList();
public List<String> macOnline = List.of();
public boolean isValid() {
return !uuid.isEmpty();

View File

@ -259,7 +259,15 @@ public class Util {
// validate parameter against pattern
String parameterPattern = parameter.getPattern();
if (parameterPattern != null) {
parameters.removeIf(param -> !param.matches(parameterPattern));
parameters.removeIf(param -> {
if (!param.matches(parameterPattern)) {
LOGGER.warn("Removing {} while processing {}, does not match pattern {}, check config.", param,
channelId, parameterPattern);
return true;
} else {
return false;
}
});
}
// validate parameter against SCPD (if not internal only)