problem accessing (the second time) InputStream from Binary properties through
LazyInputStream
----------------------------------------------------------------------------------------------
Key: SLING-2221
URL: https://issues.apache.org/jira/browse/SLING-2221
Project: Sling
Issue Type: Bug
Components: JCR
Affects Versions: JCR Resource 2.0.10
Environment: CQ5.4
Reporter: Marc Riess
Priority: Minor
Using JCR API everything is fine but with Sling API the second time I ask for
the InputStream it's empty.
For example :
try {
is = rendition.getStream();
// the is.available >0
.. read the stream
} finally { IO.tryClose(is); }
try {
is = rendition.getStream();
// is.reset() not supported
// the is.available == 0
} finally { IO.tryClose(is); }
but if I do
try {
is =
rendition.adaptTo(javax.jcr.Node.class).getNode(JcrConstants.JCR_CONTENT).getProperty(JcrConstants.JCR_DATA).getBinary().getStream();
// the is.available >0
.. read the stream
} finally { IO.tryClose(is); }
try {
is =
rendition.adaptTo(javax.jcr.Node.class).getNode(JcrConstants.JCR_CONTENT).getProperty(JcrConstants.JCR_DATA).getBinary().getStream();
// the is.available >0
} finally { IO.tryClose(is); }
NB: the version used is 2.0.9 -
org.apache.sling.jcr.resource.internal.helper.LazyInputStream
I asked on CQ5 forum and Alex told me it could be useful to describe the issue
here; its answer :
CQ DAM's rendition (which I guess you are using here) uses Sling's ValueMap to
retrieve the InputStream. That seems to cache the stream like any other
value... it might be worth improving on that and reporting an issue with Sling.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira