You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Justin Edelson (JIRA)" <ji...@apache.org> on 2011/09/15 21:43:08 UTC
[jira] [Resolved] (SLING-2221) problem accessing (the second time)
InputStream from Binary properties through LazyInputStream
[ https://issues.apache.org/jira/browse/SLING-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Justin Edelson resolved SLING-2221.
-----------------------------------
Resolution: Fixed
Fix Version/s: JCR Resource 2.1.0
fixed in r1171237
> 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
> Assignee: Justin Edelson
> Priority: Minor
> Fix For: JCR Resource 2.1.0
>
>
> 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