Skip to content

Commit 4eaa613

Browse files
rsafonsecayadvr
authored andcommitted
Fix findbugs SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING warning in Upgrade30xBase.java There was no risk of sql injection here, nor any need to use PreparedStatement, still, this fixes the warning
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> This closes #442
1 parent 869cc0c commit 4eaa613

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ public abstract class Upgrade30xBase implements DbUpgrade {
3232
final static Logger s_logger = Logger.getLogger(Upgrade30xBase.class);
3333

3434
protected String getNetworkLabelFromConfig(Connection conn, String name) {
35-
String sql = "SELECT value FROM `cloud`.`configuration` where name = '" + name + "'";
35+
String sql = "SELECT value FROM `cloud`.`configuration` where name = ?";
3636
String networkLabel = null;
3737
PreparedStatement pstmt = null;
3838
ResultSet rs = null;
3939
try {
4040
pstmt = conn.prepareStatement(sql);
41+
pstmt.setString(1,name);
4142
rs = pstmt.executeQuery();
4243
if (rs.next()) {
4344
networkLabel = rs.getString(1);

0 commit comments

Comments
 (0)