From 53e42fb45e87ff7369bd72fdb80a101ca320a292 Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 22 Jun 2015 01:07:59 +0200 Subject: [PATCH] Fix findbugs SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING warning in Upgrade410to420.java Signed-off-by: Daan Hoogland This closes #505 --- engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java index 51da73f2d04..7e7f7b7d36c 100644 --- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java @@ -692,9 +692,10 @@ public class Upgrade410to420 implements DbUpgrade { try(ResultSet rsLabel = sel_pstmt.executeQuery();) { newLabel = getNewLabel(rsLabel, trafficTypeVswitchParamValue); try(PreparedStatement update_pstmt = - conn.prepareStatement("update physical_network_traffic_types set vmware_network_label = " + newLabel + " where traffic_type = '" + trafficType + - "' and vmware_network_label is not NULL;");) { + conn.prepareStatement("update physical_network_traffic_types set vmware_network_label = ? where traffic_type = ? and vmware_network_label is not NULL;");) { s_logger.debug("Updating vmware label for " + trafficType + " traffic. Update SQL statement is " + pstmt); + pstmt.setString(1, newLabel); + pstmt.setString(2, trafficType); update_pstmt.executeUpdate(); }catch (SQLException e) { throw new CloudRuntimeException("Unable to set vmware traffic labels ", e);