dirkv 02/01/02 13:18:48
Modified: src/stores/slidestore/j2ee J2EEContentStore.java
Log:
apply same patch on this DB store
solve bug 5582: JDBCContentStore.retrieveRevisionContent not closing connections
submitted by Chris Kimpton
Revision Changes Path
1.2 +13 -13 jakarta-slide/src/stores/slidestore/j2ee/J2EEContentStore.java
Index: J2EEContentStore.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/stores/slidestore/j2ee/J2EEContentStore.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- J2EEContentStore.java 24 Dec 2001 22:08:13 -0000 1.1
+++ J2EEContentStore.java 2 Jan 2002 21:18:48 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/stores/slidestore/j2ee/J2EEContentStore.java,v 1.1
2001/12/24 22:08:13 remm Exp $
- * $Revision: 1.1 $
- * $Date: 2001/12/24 22:08:13 $
+ * $Header:
/home/cvs/jakarta-slide/src/stores/slidestore/j2ee/J2EEContentStore.java,v 1.2
2002/01/02 21:18:48 dirkv Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/01/02 21:18:48 $
*
* ====================================================================
*
@@ -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,17 +84,20 @@
import org.apache.slide.security.*;
import org.apache.slide.content.*;
import org.apache.slide.util.logger.Logger;
+import slidestore.reference.util.JDBCAwareInputStream;
+
//For the Datasource implementation
import javax.sql.DataSource;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+
/**
* J2EE 2.0 compliant implementation of ContentStore.
*
* @author Ashok Kumar
* @contact <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class J2EEContentStore extends AbstractService
implements ContentStore {
@@ -105,7 +107,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;
@@ -414,17 +419,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]>