You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by oz...@apache.org on 2004/11/22 17:24:42 UTC

cvs commit: jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms AbstractRDBMSStore.java

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: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org