[ 
https://issues.apache.org/jira/browse/SLING-745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651933#action_12651933
 ] 

Bertrand Delacretaz commented on SLING-745:
-------------------------------------------

Patch looks good to me.

> Bundle installation fails if manifest is larger than 2K bytes
> -------------------------------------------------------------
>
>                 Key: SLING-745
>                 URL: https://issues.apache.org/jira/browse/SLING-745
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR Install
>    Affects Versions: JCR Install 2.0.4
>            Reporter: Felix Meschberger
>            Priority: Critical
>             Fix For: JCR Install 2.0.4
>
>         Attachments: SLING-745.patch
>
>
> Currently the BundleResourceProcessor marks the bundle input stream for 2048 
> bytes of read-head to read the MANIFEST.MF file. Unfortunately, this "limits" 
> supprt for MANIFEST.MF files to 2048 bytes. We have one situation, where the 
> actual MANIFEST.MF file is more than 64'000 bytes. Reading the MANIFEST.MF 
> file succeeds but resetting the input stream fails.
> I propose to modify the BundleResourceProcessor and the FileInstallableData 
> as follows:
> * BundleResourceProcessor.getMatchingBundle gets the InstallableData object 
> and gets the InputStream directly from that one and also closes that 
> "private" stream after reading the MANIFEST.MF file.
> * FileInstallableData is modified to not open the InputStream before hand but 
> to keep the JCR Property and open the stream on demand in the adaptTo method.
> * BundleResourceProcessor.installOrUpdate is modified in the finally close to 
> catch IOException on closing the input stream. In addition the null-check is 
> not required because the data variable will never be null in the finally 
> clause.
> BTW: Opening the InputStream upfront in the FileInstallableData constructor 
> may even leave this input stream open, should that stream not be retrieved to 
> be closed !

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to