From 4e57b96f75e7bd75dfb70781354aa77627ed11f4 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lievremont Date: Thu, 6 Feb 2014 09:16:53 +0100 Subject: [PATCH] Fix quality flaws --- .../core/persistence/profiling/ProfilingDataSource.java | 6 ++++-- .../profiling/ProfilingPreparedStatementHandler.java | 6 +++--- .../persistence/profiling/ProfilingStatementHandler.java | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/profiling/ProfilingDataSource.java b/sonar-core/src/main/java/org/sonar/core/persistence/profiling/ProfilingDataSource.java index 90f0dd296b3..699b4cb257a 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/profiling/ProfilingDataSource.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/profiling/ProfilingDataSource.java @@ -307,12 +307,14 @@ class ProfilingDataSource extends BasicDataSource { @Override public Connection getConnection() throws SQLException { - return (Connection) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { Connection.class }, new ProfilingConnectionHandler(delegate.getConnection())); + return (Connection) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { Connection.class }, + new ProfilingConnectionHandler(delegate.getConnection())); } @Override public Connection getConnection(String user, String pass) throws SQLException { - return (Connection) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { Connection.class }, new ProfilingConnectionHandler(delegate.getConnection(user, pass))); + return (Connection) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { Connection.class }, + new ProfilingConnectionHandler(delegate.getConnection(user, pass))); } @Override diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/profiling/ProfilingPreparedStatementHandler.java b/sonar-core/src/main/java/org/sonar/core/persistence/profiling/ProfilingPreparedStatementHandler.java index f773d8fb3c6..8785e517b4c 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/profiling/ProfilingPreparedStatementHandler.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/profiling/ProfilingPreparedStatementHandler.java @@ -27,7 +27,7 @@ import java.sql.PreparedStatement; class ProfilingPreparedStatementHandler implements InvocationHandler { - private static final SqlProfiling profiling = new SqlProfiling(); + private static final SqlProfiling PROFILING = new SqlProfiling(); private final PreparedStatement statement; private final String sql; @@ -39,9 +39,9 @@ class ProfilingPreparedStatementHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.getName().startsWith("execute")) { - StopWatch watch = profiling.start(); + StopWatch watch = PROFILING.start(); Object result = method.invoke(statement, args); - profiling.stop(watch, sql); + PROFILING.stop(watch, sql); return result; } else { return method.invoke(statement, args); diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/profiling/ProfilingStatementHandler.java b/sonar-core/src/main/java/org/sonar/core/persistence/profiling/ProfilingStatementHandler.java index 3180bf0ee1f..0ba978796a6 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/profiling/ProfilingStatementHandler.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/profiling/ProfilingStatementHandler.java @@ -27,7 +27,7 @@ import java.sql.Statement; class ProfilingStatementHandler implements InvocationHandler { - private static final SqlProfiling profiling = new SqlProfiling(); + private static final SqlProfiling PROFILING = new SqlProfiling(); private final Statement statement; ProfilingStatementHandler(Statement statement) { @@ -37,9 +37,9 @@ class ProfilingStatementHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.getName().startsWith("execute")) { - StopWatch watch = profiling.start(); + StopWatch watch = PROFILING.start(); Object result = method.invoke(statement, args); - profiling.stop(watch, (String) args[0]); + PROFILING.stop(watch, (String) args[0]); return result; } else { return method.invoke(statement, args); -- 2.39.5