tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1380793 - in /tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc: bugs/ test/
Date Tue, 04 Sep 2012 18:29:42 GMT
Author: markt
Date: Tue Sep  4 18:29:41 2012
New Revision: 1380793

URL: http://svn.apache.org/viewvc?rev=1380793&view=rev
Log:
Clean-up
 - fix indentation
 - silence a handful of fairly pointless FindBugs warnings

Modified:
    tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java
    tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/AlternateUsernameTest.java
    tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/CreateTestTable.java
    tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java
    tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOAsyncExample.java
    tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOExample.java
    tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestAsyncQueue.java

Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java?rev=1380793&r1=1380792&r2=1380793&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java
Tue Sep  4 18:29:41 2012
@@ -59,7 +59,9 @@ public class Bug51582
     Statement st = con.createStatement();
     try {
         st.execute("DROP ALIAS SLEEP");
-    }catch (Exception ignore) {}
+    } catch (Exception ignore) {
+        // Ignore
+    }
     st.execute("CREATE ALIAS SLEEP AS $$\nboolean sleep() {\n        try {\n            Thread.sleep(10000);\n
           return true;        } catch (Exception x) {\n            return false;\n      
 }\n}\n$$;");
     st.close();
     con.close();

Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/AlternateUsernameTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/AlternateUsernameTest.java?rev=1380793&r1=1380792&r2=1380793&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/AlternateUsernameTest.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/AlternateUsernameTest.java
Tue Sep  4 18:29:41 2012
@@ -133,7 +133,11 @@ public class AlternateUsernameTest exten
                     x.printStackTrace();
                 } finally {
                     if (pcon!=null) {
-                        try {pcon.close(); }catch (Exception ignore) {}
+                        try {
+                            pcon.close();
+                        } catch (Exception ignore) {
+                            // Ignore
+                        }
                         pcon = null;
                     }
                 }

Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/CreateTestTable.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/CreateTestTable.java?rev=1380793&r1=1380792&r2=1380793&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/CreateTestTable.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/CreateTestTable.java
Tue Sep  4 18:29:41 2012
@@ -39,7 +39,9 @@ public class CreateTestTable extends Def
         Statement st = con.createStatement();
         try {
             st.execute("create table test(id int not null, val1 varchar(255), val2 varchar(255),
val3 varchar(255), val4 varchar(255))");
-        }catch (Exception ignore) {}
+        } catch (Exception ignore) {
+            // Ignore
+        }
         st.close();
         con.close();
     }
@@ -83,7 +85,9 @@ public class CreateTestTable extends Def
             Statement st = con.createStatement();
             try {
                 st.execute("drop table test");
-            }catch (Exception ignore) {}
+            } catch (Exception ignore) {
+                // Ignore
+            }
             st.execute("create table test(id int not null, val1 varchar(255), val2 varchar(255),
val3 varchar(255), val4 varchar(255))");
             st.close();
         }

Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java?rev=1380793&r1=1380792&r2=1380793&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java
Tue Sep  4 18:29:41 2012
@@ -180,8 +180,16 @@ public class DefaultTestCase extends Tes
 
     @Override
     protected void tearDown() throws Exception {
-        try {datasource.close();}catch(Exception ignore){}
-        try {tDatasource.close();}catch(Exception ignore){}
+        try {
+            datasource.close();
+        } catch (Exception ignore){
+            // Ignore
+        }
+        try {
+            tDatasource.close();
+        } catch (Exception ignore){
+            // Ignore
+        }
         //try {((ComboPooledDataSource)c3p0Datasource).close(true);}catch(Exception ignore){}
         datasource = null;
         tDatasource = null;

Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOAsyncExample.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOAsyncExample.java?rev=1380793&r1=1380792&r2=1380793&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOAsyncExample.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOAsyncExample.java
Tue Sep  4 18:29:41 2012
@@ -54,27 +54,32 @@ public class SimplePOJOAsyncExample {
 
         Connection con = null;
         try {
-          Future<Connection> future = datasource.getConnectionAsync();
-          while (!future.isDone()) {
-              System.out.println("Connection is not yet available. Do some background work");
-              try {
-                  Thread.sleep(100); //simulate work
-              }catch (InterruptedException x) {
-                  Thread.interrupted();
-              }
-          }
-          con = future.get(); //should return instantly
-          Statement st = con.createStatement();
-          ResultSet rs = st.executeQuery("select * from user");
-          int cnt = 1;
-          while (rs.next()) {
-              System.out.println((cnt++)+". Host:" +rs.getString("Host")+" User:"+rs.getString("User")+"
Password:"+rs.getString("Password"));
-          }
-          rs.close();
-          st.close();
+            Future<Connection> future = datasource.getConnectionAsync();
+            while (!future.isDone()) {
+                System.out.println("Connection is not yet available. Do some background work");
+            try {
+                Thread.sleep(100); //simulate work
+                } catch (InterruptedException x) {
+                    Thread.interrupted();
+                }
+            }
+            con = future.get(); //should return instantly
+            Statement st = con.createStatement();
+            ResultSet rs = st.executeQuery("select * from user");
+            int cnt = 1;
+            while (rs.next()) {
+                System.out.println((cnt++)+". Host:" +rs.getString("Host")+" User:"+rs.getString("User")+"
Password:"+rs.getString("Password"));
+            }
+            rs.close();
+            st.close();
         } finally {
-          if (con!=null) try {con.close();}catch (Exception ignore) {}
+            if (con!=null) {
+                try {
+                    con.close();
+                } catch (Exception ignore) {
+                    // Ignore
+                }
+            }
         }
     }
-
 }
\ No newline at end of file

Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOExample.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOExample.java?rev=1380793&r1=1380792&r2=1380793&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOExample.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOExample.java
Tue Sep  4 18:29:41 2012
@@ -53,18 +53,23 @@ public class SimplePOJOExample {
 
         Connection con = null;
         try {
-          con = datasource.getConnection();
-          Statement st = con.createStatement();
-          ResultSet rs = st.executeQuery("select * from user");
-          int cnt = 1;
-          while (rs.next()) {
-              System.out.println((cnt++)+". Host:" +rs.getString("Host")+" User:"+rs.getString("User")+"
Password:"+rs.getString("Password"));
-          }
-          rs.close();
-          st.close();
+            con = datasource.getConnection();
+            Statement st = con.createStatement();
+            ResultSet rs = st.executeQuery("select * from user");
+            int cnt = 1;
+            while (rs.next()) {
+                System.out.println((cnt++)+". Host:" +rs.getString("Host")+" User:"+rs.getString("User")+"
Password:"+rs.getString("Password"));
+            }
+            rs.close();
+            st.close();
         } finally {
-          if (con!=null) try {con.close();}catch (Exception ignore) {}
+            if (con!=null) {
+                try {
+                    con.close();
+                } catch (Exception ignore) {
+                    // Ignore
+                }
+            }
         }
     }
-
 }

Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestAsyncQueue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestAsyncQueue.java?rev=1380793&r1=1380792&r2=1380793&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestAsyncQueue.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestAsyncQueue.java
Tue Sep  4 18:29:41 2012
@@ -78,7 +78,9 @@ public class TestAsyncQueue extends Test
         public void run() {
             try {
                 sleep(delay);
-            }catch (Exception ignore){}
+            } catch (Exception ignore){
+                // Ignore
+            }
             offered = true;
             TestAsyncQueue.this.queue.offer(item);
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message