mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
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
This commit is contained in:
parent
869cc0c9f2
commit
4eaa613a0b
@ -32,12 +32,13 @@ public abstract class Upgrade30xBase implements DbUpgrade {
|
||||
final static Logger s_logger = Logger.getLogger(Upgrade30xBase.class);
|
||||
|
||||
protected String getNetworkLabelFromConfig(Connection conn, String name) {
|
||||
String sql = "SELECT value FROM `cloud`.`configuration` where name = '" + name + "'";
|
||||
String sql = "SELECT value FROM `cloud`.`configuration` where name = ?";
|
||||
String networkLabel = null;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
pstmt = conn.prepareStatement(sql);
|
||||
pstmt.setString(1,name);
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next()) {
|
||||
networkLabel = rs.getString(1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user