Skip to content

Commit

Permalink
Skip loading/migrating items with invalid name (openhab#14054)
Browse files Browse the repository at this point in the history
Fixes openhab#14053

Signed-off-by: Jacob Laursen <[email protected]>
  • Loading branch information
jlaur authored Dec 27, 2022
1 parent e7938ae commit 0b59be6
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.knowm.yank.Yank;
import org.openhab.core.i18n.TimeZoneProvider;
import org.openhab.core.items.Item;
import org.openhab.core.items.ItemUtil;
import org.openhab.core.persistence.FilterCriteria;
import org.openhab.core.persistence.HistoricItem;
import org.openhab.core.persistence.PersistenceItemInfo;
Expand Down Expand Up @@ -340,6 +341,11 @@ public void populateItemNameToTableNameMap() throws JdbcSQLException {
}
} else {
for (ItemsVO vo : getItemIDTableNames()) {
String itemName = vo.getItemName();
if (!ItemUtil.isValidItemName(itemName)) {
logger.warn("Skipping invalid item name {}", itemName);
continue;
}
itemNameToTableNameMap.put(vo.getItemName(),
namingStrategy.getTableName(vo.getItemId(), vo.getItemName()));
}
Expand Down Expand Up @@ -429,6 +435,10 @@ private void formatTableNames() throws JdbcSQLException {
}
oldNewTableNames = new ArrayList<>();
for (String itemName : itemTables) {
if (!ItemUtil.isValidItemName(itemName)) {
logger.warn("JDBC::formatTableNames: Skipping invalid item name {}", itemName);
continue;
}
ItemsVO isvo = new ItemsVO();
isvo.setItemName(itemName);
isvo.setItemsManageTable(conf.getItemsManageTable());
Expand Down

0 comments on commit 0b59be6

Please sign in to comment.