[jboss-svn-commits] JBL Code SVN: r35247 - in labs/jbossesb/branches/JBESB_4_9_CP/product: rosetta/src/org/jboss/internal/soa/esb/dependencies and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Sep 23 10:05:48 EDT 2010


Author: tcunning
Date: 2010-09-23 10:05:47 -0400 (Thu, 23 Sep 2010)
New Revision: 35247

Modified:
   labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/H2Database.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabase.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/soa/esb/parameters/ParamRepositoryFactory.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/services/spring/src/main/java/org/jboss/soa/esb/actions/AbstractSpringAction.java
Log:
JBESB-2969
Findbugs fixes - mostly cleaning up try/catch blocks and statement/resultset closes.


Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java	2010-09-23 13:17:18 UTC (rev 35246)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java	2010-09-23 14:05:47 UTC (rev 35247)
@@ -635,19 +635,16 @@
         if (!"true".equalsIgnoreCase(Configuration.getRedeliveryDlsOn())) {
             _logger.debug("org.jboss.soa.esb.dls.redeliver is turned off");
         } else {
-            if (dlQueueInvoker == null) {
-                synchronized (ServiceInvoker.dlqService) {
-                    if (dlQueueInvoker == null) {
+           synchronized (ServiceInvoker.dlqService) {
+        	   if (dlQueueInvoker == null) {
                         dlQueueInvoker = new ServiceInvoker(ServiceInvoker.dlqService);
-                    }
-                }
+               }
             }
-
             dlQueueInvoker.deliverAsync(message);
         }
     }
 
-    private class MessagePickupProspect {
+    private static class MessagePickupProspect {
         private String messageId;
         private String status;
         private long timestamp;

Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/H2Database.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/H2Database.java	2010-09-23 13:17:18 UTC (rev 35246)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/H2Database.java	2010-09-23 14:05:47 UTC (rev 35247)
@@ -573,7 +573,10 @@
 
         if (!h2Dir.exists())
         {
-            h2Dir.mkdirs();
+            boolean result = h2Dir.mkdirs();
+            if (!result) {
+                throw new IOException("Failed to create directory: " + h2Dir);            	
+            }
         }
         else if (!h2Dir.isDirectory())
         {

Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabase.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabase.java	2010-09-23 13:17:18 UTC (rev 35246)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/HypersonicDatabase.java	2010-09-23 14:05:47 UTC (rev 35247)
@@ -27,6 +27,7 @@
 import java.lang.reflect.Method;
 import java.sql.Connection;
 import java.sql.DriverManager;
+import java.sql.ResultSet;
 import java.sql.Statement;
 
 import org.jboss.mx.util.MBeanProxyExt;
@@ -717,7 +718,17 @@
          shutdownCommand = DEFAULT_IN_PROCESS_SHUTDOWN_COMMAND;
       }
       
-      statement.executeQuery(shutdownCommand);
+      ResultSet rs = null;
+      try {
+    	  rs = statement.executeQuery(shutdownCommand);
+      } finally {
+          statement.close();	
+
+    	  if (rs != null) {
+    		  rs.close();
+    	  }
+      }
+      
       this.connection = null;
       log.info("Database standalone closed clean");
    }
@@ -740,17 +751,19 @@
       
       try
       {
+    	  ResultSet rs = null;
           try
           {
-              statement.executeQuery(shutdownCommand);
+              rs = statement.executeQuery(shutdownCommand);
+          } finally {
+        	  if (rs != null) {
+        		  rs.close();
+        	  }
           }
-          finally
-          {
-              statement.close() ;
-          }
       }
       finally
       {
+    	  statement.close();
           this.connection = null;
       }
       log.info("Database in memory closed clean");
@@ -776,18 +789,22 @@
       
       try
       {
-          try
+    	  ResultSet rs = null;
+    	  try
           {
-              statement.executeQuery(shutdownCommand);
+              rs = statement.executeQuery(shutdownCommand);
           }
           finally
           {
-              statement.close() ;
+        	  if (rs != null) {
+        		  rs.close();
+        	  }
           }
       }
       finally
       {
-          // TODO: join thread?
+          statement.close() ;
+    	  // TODO: join thread?
           serverThread = null;
           this.connection = null;
       }
@@ -827,7 +844,10 @@
 
         if (!hypersonicDir.exists())
         {
-            hypersonicDir.mkdirs();
+            boolean result = hypersonicDir.mkdirs();
+            if (!result) {
+                throw new IOException("Failed to create directory: " + hypersonicDir);            	
+            }
         }
         else if (!hypersonicDir.isDirectory())
         {

Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/soa/esb/parameters/ParamRepositoryFactory.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/soa/esb/parameters/ParamRepositoryFactory.java	2010-09-23 13:17:18 UTC (rev 35246)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/soa/esb/parameters/ParamRepositoryFactory.java	2010-09-23 14:05:47 UTC (rev 35247)
@@ -93,7 +93,7 @@
 						instance = (ParamRepository) runtimeClass.newInstance();
 					} catch (Exception e)
 					{
-						new IllegalStateException(
+						throw new IllegalStateException(
 								"System Configuration Exception: Unable to create system "
 										+ ParamRepository.class.getSimpleName()
 										+ " instance from runtime class name ["

Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/services/spring/src/main/java/org/jboss/soa/esb/actions/AbstractSpringAction.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/services/spring/src/main/java/org/jboss/soa/esb/actions/AbstractSpringAction.java	2010-09-23 13:17:18 UTC (rev 35246)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/services/spring/src/main/java/org/jboss/soa/esb/actions/AbstractSpringAction.java	2010-09-23 14:05:47 UTC (rev 35247)
@@ -212,6 +212,9 @@
 			String[] contextXmlTokens = springContextXml.split(",");
 			
 			try {
+				// Suppressing warnings on this unused classforname because appContext is given
+				// a different value for AS4 and AS5
+				@SuppressWarnings("unused")
 				Class<?> snowdropVfsAppContextClass = ClassUtil.forName(SNOWDROP_VFS_APP_CONTEXT_IMPL, AbstractSpringAction.class);
 				appContext = new VFSClassPathXmlApplicationContextFactory().getInstance(contextXmlTokens);
 			} catch(ClassNotFoundException e) {



More information about the jboss-svn-commits mailing list