Skip to content

Commit 53e42fb

Browse files
rsafonsecaDaanHoogland
authored andcommitted
Fix findbugs SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING warning in Upgrade410to420.java
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com> This closes apache#505
1 parent b929db1 commit 53e42fb

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,9 +692,10 @@ private void upgradeVmwareLabels(Connection conn) {
692692
try(ResultSet rsLabel = sel_pstmt.executeQuery();) {
693693
newLabel = getNewLabel(rsLabel, trafficTypeVswitchParamValue);
694694
try(PreparedStatement update_pstmt =
695-
conn.prepareStatement("update physical_network_traffic_types set vmware_network_label = " + newLabel + " where traffic_type = '" + trafficType +
696-
"' and vmware_network_label is not NULL;");) {
695+
conn.prepareStatement("update physical_network_traffic_types set vmware_network_label = ? where traffic_type = ? and vmware_network_label is not NULL;");) {
697696
s_logger.debug("Updating vmware label for " + trafficType + " traffic. Update SQL statement is " + pstmt);
697+
pstmt.setString(1, newLabel);
698+
pstmt.setString(2, trafficType);
698699
update_pstmt.executeUpdate();
699700
}catch (SQLException e) {
700701
throw new CloudRuntimeException("Unable to set vmware traffic labels ", e);

0 commit comments

Comments
 (0)