diff --git a/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/db/JdbcBaseDAO.java b/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/db/JdbcBaseDAO.java index 1ce2bdf9350..1efc052d8cb 100644 --- a/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/db/JdbcBaseDAO.java +++ b/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/db/JdbcBaseDAO.java @@ -343,7 +343,7 @@ public class JdbcBaseDAO { String sql = StringUtilsExt.replaceArrayMerge(sqlInsertItemValue, new String[] { "#tableName#", "#tablePrimaryValue#" }, new String[] { storedVO.getTableName(), "?" }); java.sql.Timestamp timestamp = new java.sql.Timestamp(date.toInstant().toEpochMilli()); - Object[] params = new Object[] { storedVO.getValue(), timestamp, storedVO.getValue() }; + Object[] params = new Object[] { timestamp, storedVO.getValue(), storedVO.getValue() }; logger.debug("JDBC::doStoreItemValue sql={} timestamp={} value='{}'", sql, timestamp, storedVO.getValue()); Yank.execute(sql, params); } diff --git a/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/utils/StringUtilsExt.java b/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/utils/StringUtilsExt.java index b2b2300c806..05b761e58e5 100644 --- a/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/utils/StringUtilsExt.java +++ b/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/utils/StringUtilsExt.java @@ -42,20 +42,22 @@ public class StringUtilsExt { * @return */ public static final String replaceArrayMerge(String str, String separate, Object[] separators) { + String s = str; for (int i = 0; i < separators.length; i++) { - str = str.replaceFirst(separate, (String) separators[i]); + s = s.replaceFirst(separate, (String) separators[i]); } - return str; + return s; } /** * @see #replaceArrayMerge(String str, String separate, Object[] separators) */ public static final String replaceArrayMerge(String str, String[] separate, String[] separators) { + String s = str; for (int i = 0; i < separators.length; i++) { - str = str.replaceFirst(separate[i], separators[i]); + s = s.replaceFirst(separate[i], separators[i]); } - return str; + return s; } /**