You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Oliver Lietz (JIRA)" <ji...@apache.org> on 2014/04/29 17:43:16 UTC

[jira] [Commented] (SLING-3114) DefaultContentImporter should guard against a closed InputStream on system view imports

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

Oliver Lietz commented on SLING-3114:
-------------------------------------

[~alex.parvulescu], [~jukkaz] shouldn't we simply remove fallback to {{DefaultContentCreator}} when extension {{.jcr.xml}} is used? (by moving {{return}} to the end of the _system view imports_ block)

The name and error handling in _contentloader_ should be improved indeed - and there are some more glitches which could be fixed.


> DefaultContentImporter should guard against a closed InputStream on system view imports
> ---------------------------------------------------------------------------------------
>
>                 Key: SLING-3114
>                 URL: https://issues.apache.org/jira/browse/SLING-3114
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR ContentLoader 2.1.6
>            Reporter: Alex Parvulescu
>            Assignee: Oliver Lietz
>            Priority: Minor
>             Fix For: JCR ContentLoader 2.1.8
>
>
> For the special case of system view imports the null check [0] fails to take into account the fact that the input stream is now closed (twice even [1], [2]).
> This means that if something happened and the import did not go throught (hence the _null_ node), the code will continue and fail later (line 99) with a cryptic message: _java.io.IOException: Stream Closed_ [3]
> My proposal (no patch) is to add an else clause with a warn log and a return statement.
> [0] http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/DefaultContentImporter.java?view=markup#l77
> [1] http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/DefaultContentImporter.java?view=markup#l201
> [2] http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractSession.java?view=markup#l357
> [3]
> {noformat}
> Caused by: java.io.IOException: Stream Closed
> 	at java.io.FileInputStream.available(Native Method)
> 	at java.io.BufferedInputStream.available(BufferedInputStream.java:399)
> 	at org.apache.sling.jcr.contentloader.internal.readers.XmlReader.parseInternal(XmlReader.java:205)
> 	at org.apache.sling.jcr.contentloader.internal.readers.XmlReader.parse(XmlReader.java:189)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)