File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed
src/main/java/org/owasp/benchmark/helpers Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change 3333import org .owasp .esapi .ESAPI ;
3434
3535public class DatabaseHelper {
36- private static Statement stmt ;
3736 private static Connection conn ;
3837 public static org .springframework .jdbc .core .JdbcTemplate JDBCtemplate ;
3938 public static org .owasp .benchmark .helpers .HibernateUtil hibernateUtil =
@@ -120,13 +119,11 @@ public static java.sql.Statement getSqlStatement() {
120119 if (conn == null ) {
121120 getSqlConnection ();
122121 }
123-
124- if (stmt == null ) {
125- try {
126- stmt = conn .createStatement ();
127- } catch (SQLException e ) {
128- System .out .println ("Problem with database init." );
129- }
122+ Statement stmt = null ;
123+ try {
124+ stmt = conn .createStatement ();
125+ } catch (SQLException e ) {
126+ System .out .println ("Problem with database init." );
130127 }
131128
132129 return stmt ;
@@ -172,9 +169,7 @@ public static java.sql.Connection getSqlConnection() {
172169 }
173170
174171 public static void executeSQLCommand (String sql ) throws Exception {
175- if (stmt == null ) {
176- getSqlStatement ();
177- }
172+ Statement stmt = getSqlStatement ();
178173 stmt .executeUpdate (sql );
179174 }
180175
You can’t perform that action at this time.
0 commit comments