rationalize inventory code
[transportpce.git] / inventory / src / main / java / org / opendaylight / transportpce / inventory / INode.java
index 5279f1af326e624c74c9f1443c1d194cd0752f02..cdcfc621ef6d5e2bb71cc8796a702240ad15d7e7 100644 (file)
@@ -13,11 +13,13 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import javax.sql.DataSource;
-
 import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
+    value = "SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING",
+    justification = "TODO review the SQL statement generation process")
 public class INode {
     private static final Logger LOG = LoggerFactory.getLogger(INode.class);
 
@@ -47,7 +49,7 @@ public class INode {
         int nodeExists = 0;
         LOG.info("Checking if {} exists in DB", nodeId);
         try (Connection connection = dataSource.getConnection();
-             PreparedStatement preparedStmt = connection.prepareStatement(selectTableSQL)) {
+                PreparedStatement preparedStmt = connection.prepareStatement(selectTableSQL)) {
             preparedStmt.setString(1, nodeId);
             try (ResultSet rs = preparedStmt.executeQuery()) {
                 while (rs.next()) {
@@ -56,7 +58,7 @@ public class INode {
                 }
             }
         } catch (SQLException e) {
-            LOG.error(e.getMessage(), e);
+            LOG.error("Something wrong when fetching node in DB", e);
         }
         return nodeExists == 0 ? false : true;
     }
@@ -75,7 +77,7 @@ public class INode {
                 }
             }
         } catch (SQLException e) {
-            LOG.error(e.getMessage(), e);
+            LOG.error("Something wrong when fetching data in DB", e);
         }
         return dataExists == 0 ? false : true;
     }