From 0aded11b77db594e74611f4fa4e7ee88da0a1881 Mon Sep 17 00:00:00 2001 From: Kai Kreuzer Date: Fri, 28 Apr 2017 17:37:38 +0200 Subject: [PATCH] addresses #3335 Signed-off-by: Kai Kreuzer --- .../core/internal/ModelRepositoryImpl.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/bundles/model/org.eclipse.smarthome.model.core/src/main/java/org/eclipse/smarthome/model/core/internal/ModelRepositoryImpl.java b/bundles/model/org.eclipse.smarthome.model.core/src/main/java/org/eclipse/smarthome/model/core/internal/ModelRepositoryImpl.java index 08912dd690d..8ab982dd713 100644 --- a/bundles/model/org.eclipse.smarthome.model.core/src/main/java/org/eclipse/smarthome/model/core/internal/ModelRepositoryImpl.java +++ b/bundles/model/org.eclipse.smarthome.model.core/src/main/java/org/eclipse/smarthome/model/core/internal/ModelRepositoryImpl.java @@ -260,14 +260,19 @@ private String validateModel(String name, InputStream inputStream) throws IOExce } // Check for validation errors, but log them only - org.eclipse.emf.common.util.Diagnostic diagnostic = Diagnostician.INSTANCE - .validate(resource.getContents().get(0)); - for (org.eclipse.emf.common.util.Diagnostic d : diagnostic.getChildren()) { - warnings.add(d.getMessage()); - } - if (warnings.size() > 0) { - logger.info("Validation issues found in configuration model '{}', using it anyway:\n{}", name, - StringUtils.join(warnings, "\n")); + try { + org.eclipse.emf.common.util.Diagnostic diagnostic = Diagnostician.INSTANCE + .validate(resource.getContents().get(0)); + for (org.eclipse.emf.common.util.Diagnostic d : diagnostic.getChildren()) { + warnings.add(d.getMessage()); + } + if (warnings.size() > 0) { + logger.info("Validation issues found in configuration model '{}', using it anyway:\n{}", name, + StringUtils.join(warnings, "\n")); + } + } catch (NullPointerException e) { + // see https://github.com/eclipse/smarthome/issues/3335 + logger.debug("Validation of '{}' skipped due to internal errors.", name); } } } finally {