ozeigermann    2004/11/22 08:24:42

  Modified:    src/stores/org/apache/slide/store/impl/rdbms
                        AbstractRDBMSStore.java
  Log:
  Fixed hazard of unclosed connection when an error occurs while retrieving 
content
  
  Revision  Changes    Path
  1.12      +17 -11    
jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/AbstractRDBMSStore.java
  
  Index: AbstractRDBMSStore.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/AbstractRDBMSStore.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AbstractRDBMSStore.java   30 Oct 2004 12:48:42 -0000      1.11
  +++ AbstractRDBMSStore.java   22 Nov 2004 16:24:41 -0000      1.12
  @@ -787,18 +787,24 @@
                   connection = getNewConnection();
                   return adapter.retrieveRevisionContent(connection, uri, 
revisionDescriptor, true);
               } catch (SQLException e) {
  -                throw new ServiceAccessException(this, e);
  -            } finally {
  +                // only close connection in case of error as standard closing
                   // will be done in adapter or upon closing of stream
  -                /*
                   if (connection != null) {
                       try {
  -                        connection.close();
  -                    } catch (SQLException e) {
  -                        getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
  +                        if (!tmCommits) {
  +                            connection.commit();
  +                        }
  +                    } catch (SQLException e2) {
  +                        throw new ServiceAccessException(this, e2);
  +                    } finally {
  +                        try {
  +                            connection.close();
  +                        } catch (SQLException e2) {
  +                            getLogger().log(e2, LOG_CHANNEL, Logger.WARNING);
  +                        }
                       }
                   }
  -                */
  +                throw new ServiceAccessException(this, e);
               }
           } else {
               return adapter.retrieveRevisionContent(getCurrentConnection(), 
uri, revisionDescriptor, false);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to