model.core: respect OSGi lifecycle (#592)

Fixes: https://github.com/openhab/openhab-core/issues/591

Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
This commit is contained in:
Markus Rathgeb 2019-02-21 09:13:54 +00:00 committed by Wouter Born
parent 32bee0e22c
commit 45858f2dd2

View File

@ -98,8 +98,10 @@ public class FolderObserver extends AbstractWatchService {
protected void removeModelParser(ModelParser modelParser) {
parsers.remove(modelParser.getExtension());
Set<String> removed = modelRepo.removeAllModelsOfType(modelParser.getExtension());
ignoredFiles.addAll(removed.stream().map(name -> nameFileMap.get(name)).collect(Collectors.toSet()));
if (modelRepo != null) {
Set<String> removed = modelRepo.removeAllModelsOfType(modelParser.getExtension());
ignoredFiles.addAll(removed.stream().map(name -> nameFileMap.get(name)).collect(Collectors.toSet()));
}
}
@Activate