cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1398292 - in /cxf/branches/2.6.x-fixes: ./ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
Date Mon, 15 Oct 2012 14:01:33 GMT
Author: ay
Date: Mon Oct 15 14:01:32 2012
New Revision: 1398292

URL: http://svn.apache.org/viewvc?rev=1398292&view=rev
Log:
Merged revisions 1398285 via  svn merge from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1398285 | ay | 2012-10-15 15:36:46 +0200 (Mon, 15 Oct 2012) | 1 line
  
  clean up for some sonar issues
........

Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
    cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java

Propchange: cxf/branches/2.6.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java?rev=1398292&r1=1398291&r2=1398292&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
Mon Oct 15 14:01:32 2012
@@ -884,11 +884,12 @@ public class RMTxStore implements RMStor
     }
     
     protected void verifyTable(Connection con, String tableName, String[][] tableCols) {
+        List<String[]> newCols = new ArrayList<String[]>();
+        ResultSet rs = null;
         try {
             DatabaseMetaData metadata = con.getMetaData();
-            ResultSet rs = metadata.getColumns(null, null, tableName, "%");
+            rs = metadata.getColumns(null, null, tableName, "%");
             Set<String> dbCols = new HashSet<String>();
-            List<String[]> newCols = new ArrayList<String[]>(); 
             while (rs.next()) {
                 dbCols.add(rs.getString(4));
             }
@@ -897,12 +898,26 @@ public class RMTxStore implements RMStor
                     newCols.add(col);
                 }
             }
-            if (newCols.size() > 0) {
-                // need to add the new columns
-                if (LOG.isLoggable(Level.FINE)) {
-                    LOG.log(Level.FINE, "Table " + tableName + " needs additional columns");
+        } catch (SQLException ex) {
+            if (LOG.isLoggable(Level.FINE)) {
+                LOG.fine("Table " + tableName + " cannot be verified.");
+            }
+        } finally {
+            if (rs != null) {
+                try {
+                    rs.close();
+                } catch (SQLException e) {
+                    // ignore
                 }
+            }
+        }
+        if (newCols.size() > 0) {
+            // need to add the new columns
+            if (LOG.isLoggable(Level.FINE)) {
+                LOG.log(Level.FINE, "Table " + tableName + " needs additional columns");
+            }
                 
+            try { 
                 for (String[] newCol : newCols) {
                     Statement st = con.createStatement();
                     try {
@@ -916,11 +931,8 @@ public class RMTxStore implements RMStor
                         st.close();
                     }
                 }
-            }
-            
-        } catch (SQLException ex) {
-            if (LOG.isLoggable(Level.FINE)) {
-                LOG.fine("Table " + tableName + " cannot be verified.");
+            } catch (SQLException ex) {
+                LOG.log(Level.WARNING, "Table " + tableName + " cannot be altered.", ex);
             }
         }
     }
@@ -953,6 +965,7 @@ public class RMTxStore implements RMStor
         for (int i = 0; i < SET_SCHEMA_STMT_STRS.length; i++) {
             try {
                 stmt.executeUpdate(MessageFormat.format(SET_SCHEMA_STMT_STRS[i], schemaName));
+                ex0 = null;
                 break;
             } catch (SQLException ex) {
                 ex.setNextException(ex0);
@@ -1266,4 +1279,4 @@ public class RMTxStore implements RMStor
         // check for a transient or non-transient connection exception
         return ex.getSQLState() != null && ex.getSQLState().startsWith("08");
     }
-}
\ No newline at end of file
+}

Modified: cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java?rev=1398292&r1=1398291&r2=1398292&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
Mon Oct 15 14:01:32 2012
@@ -632,14 +632,14 @@ public class RetransmissionQueueImpl imp
         /**
          * Cancel further resend (although no ACK has been received).
          */
-        protected void cancel() {
+        protected synchronized void cancel() {
             if (null != nextTask) {
                 nextTask.cancel();
                 releaseSavedMessage();
             }
         }
 
-        protected void suspend() {
+        protected synchronized void suspend() {
             suspended = true;
             pending = false;
             //TODO release the message and later reload it upon resume
@@ -649,7 +649,7 @@ public class RetransmissionQueueImpl imp
             }
         }
 
-        protected void resume() {
+        protected synchronized void resume() {
             suspended = false;
             next = new Date(System.currentTimeMillis());
             attempted();



Mime
View raw message