dirkv 02/01/02 13:17:39
Modified: src/stores/slidestore/reference JDBCContentStore.java
Log:
solve bug 5582: JDBCContentStore.retrieveRevisionContent not closing connections
submitted by Chris Kimpton
Revision Changes Path
1.13 +11 -13
jakarta-slide/src/stores/slidestore/reference/JDBCContentStore.java
Index: JDBCContentStore.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/stores/slidestore/reference/JDBCContentStore.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- JDBCContentStore.java 22 Sep 2001 12:53:12 -0000 1.12
+++ JDBCContentStore.java 2 Jan 2002 21:17:39 -0000 1.13
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/stores/slidestore/reference/JDBCContentStore.java,v 1.12
2001/09/22 12:53:12 dirkv Exp $
- * $Revision: 1.12 $
- * $Date: 2001/09/22 12:53:12 $
+ * $Header:
/home/cvs/jakarta-slide/src/stores/slidestore/reference/JDBCContentStore.java,v 1.13
2002/01/02 21:17:39 dirkv Exp $
+ * $Revision: 1.13 $
+ * $Date: 2002/01/02 21:17:39 $
*
* ====================================================================
*
@@ -73,7 +73,6 @@
import java.io.OutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.InputStreamReader;
import java.io.IOException;
import java.io.File;
import java.sql.*;
@@ -85,12 +84,13 @@
import org.apache.slide.security.*;
import org.apache.slide.content.*;
import org.apache.slide.util.logger.Logger;
+import slidestore.reference.util.JDBCAwareInputStream;
/**
* JDBC 2.0 compliant implementation of ContentStore.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
- * @version $Revision: 1.12 $
+ * @version $Revision: 1.13 $
*/
public class JDBCContentStore extends AbstractSimpleService
implements ContentStore {
@@ -100,7 +100,10 @@
public static final int BUFFER_SIZE = 2048;
+
+ /** @deprecated */ // FIXME: remove this
public static final String CHARACTER_ENCODING = "8859_1";
+
protected static final int REVISION_URI = 1;
protected static final int REVISION_NUMBER = 2;
protected static final int REVISION_CONTENT = 3;
@@ -442,17 +445,12 @@
(uri.toString(),
revisionDescriptor.getRevisionNumber());
}
- InputStreamReader reader = new InputStreamReader
- (is, CHARACTER_ENCODING);
result = new NodeRevisionContent();
- result.setContent(reader);
result.setContent(is);
- // Don't close the statement or the result set here (because
- // otherwise the is and the reader returned would be closed).
- // If this proves to be a problem, then the binary content of the
- // resource must either be buffer to the disk or to memory.
- // FIXME ?
+ // this input stream passes on the closure of itself onto the
+ // jdbc statement and resultSet
+ result.setContent( new JDBCAwareInputStream(is,selectStatement) );
} catch (SQLException e) {
getLogger().log(e,LOG_CHANNEL,Logger.ERROR);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>