Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Catch NPE and do proper logging. #3336

Merged
merged 1 commit into from
Apr 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down