- catch (Throwable t) {
- logger.error("EntityImages.getIcon failed: "+t.toString());
- t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
-
- try {
- con.setAutoCommit(true);
- }
- catch (SQLException e) {
- logger.error("EntityImages.getIcon resetting transaction mode failed: " + e.toString());
- e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
- }
- try {
- theStorageObject.freeConnection(con, stmt);
- }
- catch (Throwable e) {
- logger.error("EntityImages -- freeing connection failed: " + e.getMessage());
- }
-
- throwStorageObjectFailure(t, "EntityImages -- getIcon failed:");
- }
-
- return img_in;
- }
-
- /**
- * a small wrapper class that allows us to store the DB connection resources
- * that the BlobInputStream is using and free them upon closing of the stream
- */
- private class ImageInputStream extends InputStream {
-
- InputStream _in;
- Connection _con;
- Statement _stmt;
-
- public ImageInputStream(BlobInputStream in, Connection con,
- Statement stmt ) {
- _in = in;
- _con = con;
- _stmt = stmt;
- }
-
- public void close () throws IOException {
- _in.close();
- try {
- _con.setAutoCommit(true);
- theStorageObject.freeConnection(_con,_stmt);
- } catch (Exception e) {
- throw new IOException("close(): "+e.toString());
- }
- }
-
- public int read() throws IOException {
- return _in.read();