A bug that was fixed with
DS-677 which fixed a problem where reading bitstreams left a database connection open with out explicitly closing it. This is a good thing, however a side effect of this was if the theme pulled in an XML-based bitstream into it's XSL for special case rendering the database connection would be closed on it.
This patch adds a bit of logic in the bitstreamreader to check if a database connection is allready available for the request, before creating a new one. Then the reader will only close connections that it opened. If the connection was opened by the regular aspect pipeline then the aspects will close the connection.