You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Alex Parvulescu (JIRA)" <ji...@apache.org> on 2013/09/25 11:30:02 UTC

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

Alex Parvulescu created SLING-3114:
--------------------------------------

             Summary: 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
            Priority: Minor


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]
{code}
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)
{code}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira