Do not use toString() with loggers 05/85405/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 28 Oct 2019 12:39:17 +0000 (13:39 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 28 Oct 2019 12:39:17 +0000 (13:39 +0100)
Formatting statements which are arguments to debug() is wasteful,
as logging implementation will do the right thing if/when needed.

Change-Id: Ic00eec1a23378f70b272151fc1224e9c13b0ebd8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
aaa-shiro/impl/src/main/java/org/opendaylight/aaa/datastore/h2/DomainStore.java
aaa-shiro/impl/src/main/java/org/opendaylight/aaa/datastore/h2/RoleStore.java
aaa-shiro/impl/src/main/java/org/opendaylight/aaa/datastore/h2/UserStore.java

index 06251bff230cdde90fab4856accd2fc1160a5bd8..d6e7debc49041691e2d5978f645701ae321d1334 100644 (file)
@@ -71,7 +71,7 @@ public class DomainStore extends AbstractStore<Domain> {
         try (Connection conn = dbConnect();
              PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM DOMAINS WHERE name = ?")) {
             pstmt.setString(1, domainName);
-            LOG.debug("query string: {}", pstmt.toString());
+            LOG.debug("query string: {}", pstmt);
             domains.setDomains(listFromStatement(pstmt));
         } catch (SQLException e) {
             LOG.error("Error listing domains matching {}", domainName, e);
@@ -84,7 +84,7 @@ public class DomainStore extends AbstractStore<Domain> {
         try (Connection conn = dbConnect();
              PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM DOMAINS WHERE domainid = ? ")) {
             pstmt.setString(1, id);
-            LOG.debug("query string: {}", pstmt.toString());
+            LOG.debug("query string: {}", pstmt);
             return firstFromStatement(pstmt);
         } catch (SQLException e) {
             LOG.error("Error retrieving domain {}", id, e);
index c39604c24b66b9fc91a8063b2333ec83e114ace1..3a911dd1824c6f74ffda30bd3151852138c0fdb3 100644 (file)
@@ -73,7 +73,7 @@ public class RoleStore extends AbstractStore<Role> {
         try (Connection conn = dbConnect();
                 PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM ROLES WHERE roleid = ? ")) {
             pstmt.setString(1, id);
-            LOG.debug("query string: {}", pstmt.toString());
+            LOG.debug("query string: {}", pstmt);
             return firstFromStatement(pstmt);
         } catch (SQLException s) {
             throw new StoreException("SQL Exception: " + s);
index d383a3182984ab0a139ae9cc4db067958a13f639..e434d17a66540ee493d7914b690559dcf2a3a7e7 100644 (file)
@@ -92,7 +92,7 @@ public class UserStore extends AbstractStore<User> {
         try (Connection conn = dbConnect();
                 PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM USERS WHERE userid = ? ")) {
             pstmt.setString(1, IDMStoreUtil.createUserid(username, domain));
-            LOG.debug("query string: {}", pstmt.toString());
+            LOG.debug("query string: {}", pstmt);
             users.setUsers(listFromStatement(pstmt));
         } catch (SQLException s) {
             throw new StoreException("SQL Exception : " + s);
@@ -104,7 +104,7 @@ public class UserStore extends AbstractStore<User> {
         try (Connection conn = dbConnect();
                 PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM USERS WHERE userid = ? ")) {
             pstmt.setString(1, id);
-            LOG.debug("query string: {}", pstmt.toString());
+            LOG.debug("query string: {}", pstmt);
             return firstFromStatement(pstmt);
         } catch (SQLException s) {
             throw new StoreException("SQL Exception : " + s);