mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[rrd4j] Error handling for broken rrd4j files (#13955)
* [rrd4j] Error handling for broken rrd4j files Catch exceptions thrown by getDB(..) and print the name of the affected database file. This allows to identify a broken rrd4j file. Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
parent
04f059c455
commit
6ab0561382
@ -152,7 +152,12 @@ public class RRD4jPersistenceService implements QueryablePersistenceService {
|
||||
}
|
||||
final String name = alias == null ? item.getName() : alias;
|
||||
|
||||
RrdDb db = getDB(name);
|
||||
RrdDb db = null;
|
||||
try {
|
||||
db = getDB(name);
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to open rrd4j database '{}' ({})", name, e.getClass().getName());
|
||||
}
|
||||
if (db == null) {
|
||||
return;
|
||||
}
|
||||
@ -249,7 +254,13 @@ public class RRD4jPersistenceService implements QueryablePersistenceService {
|
||||
public Iterable<HistoricItem> query(FilterCriteria filter) {
|
||||
String itemName = filter.getItemName();
|
||||
|
||||
RrdDb db = getDB(itemName);
|
||||
RrdDb db = null;
|
||||
try {
|
||||
db = getDB(itemName);
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to open rrd4j database '{}' ({})", itemName, e.getClass().getName());
|
||||
return List.of();
|
||||
}
|
||||
if (db == null) {
|
||||
logger.debug("Could not find item '{}' in rrd4j database", itemName);
|
||||
return List.of();
|
||||
|
Loading…
Reference in New Issue
Block a user