You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Tommaso Teofili (JIRA)" <ji...@apache.org> on 2017/01/17 11:20:26 UTC
[jira] [Comment Edited] (SLING-6250) Importing packages with large
headers fails
[ https://issues.apache.org/jira/browse/SLING-6250?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15825874#comment-15825874 ]
Tommaso Teofili edited comment on SLING-6250 at 1/17/17 11:19 AM:
------------------------------------------------------------------
the _stream.reset()_ call was set there to make {{LocalDistributionPackageImporter}} work together with {{AsyncDeliveryDispatchingStrategy}}, because there the same importer is used for both storing a reference package and the referenced (actual) package which come with different headers.
I have put a _TODO_ as I think that reset should be avoided at all if possible, but that's not needed in most of the cases (async dispatching is not used by default) anyway.
So I was thinking to fix the issue here (throwing a RE is probably too much anyway) and open a new one for improving the way headers are read in sync and async cases.
was (Author: teofili):
the _stream.reset()_ call was set there to make {{LocalDistributionPackageImporter}} work together with {{AsyncDeliveryDispatchingStrategy}}, because there the same importer is used for both storing a reference package and the referenced (actual) package.
I have put a _TODO_ as I think that reset should be avoided at all if possible, but that's not needed in most of the cases (async dispatching is not used by default) anyway.
So I was thinking to fix the issue here (throwing a RE is probably too much anyway) and open a new one for improving the way headers are read in sync and async cases.
> Importing packages with large headers fails
> -------------------------------------------
>
> Key: SLING-6250
> URL: https://issues.apache.org/jira/browse/SLING-6250
> Project: Sling
> Issue Type: Bug
> Components: Distribution
> Affects Versions: Content Distribution Core 0.1.18
> Reporter: Julian Sedding
> Assignee: Tommaso Teofili
> Attachments: SLING-6250-testcase.patch
>
>
> When importing packages with large headers, e.g. packages containing many paths, the following exception is thrown:
> {noformat}
> java.lang.RuntimeException: java.io.IOException: Resetting to invalid mark
> at java.io.BufferedInputStream.reset(BufferedInputStream.java:448)
> at org.apache.sling.distribution.packaging.impl.importer.LocalDistributionPackageImporter.importStream(LocalDistributionPackageImporter.java:122)
> at org.apache.sling.distribution.packaging.impl.importer.LocalDistributionPackageImporterTest.importPackageWithLargeHeader(LocalDistributionPackageImporterTest.java:100)
> {noformat}
> This happens when the header is larger than the default buffer size of the {{BufferedInputStream}} and thus its {{#mark()}} is lost and {{#reset()}} cannot happen anymore.
> I will investigate, whether we can stop relying on marked input streams. This would be desirable, because we cannot know in advance how long the header is.
> cc [~teofili]
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)