You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Julian Reschke (Jira)" <ji...@apache.org> on 2019/09/27 11:18:00 UTC

[jira] [Comment Edited] (JCR-4291) FileInputStream for workspace.xml not closed in RepositoryConfig.loadWorkspaceConfig(File)

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

Julian Reschke edited comment on JCR-4291 at 9/27/19 11:17 AM:
---------------------------------------------------------------

trunk: (2.17.3) [r1830540|http://svn.apache.org/r1830540]
2.16: (2.16.2) [r1831722|http://svn.apache.org/r1831722]
2.14: (2.14.6) [r1833731|http://svn.apache.org/r1833731]
2.12: (2.12.10) [r1840281|http://svn.apache.org/r1840281]
2.10: (2.10.9) [r1845927|http://svn.apache.org/r1845927]
2.8: (2.8.10) [r1851059|http://svn.apache.org/r1851059]



was (Author: reschke):
trunk: [r1830540|http://svn.apache.org/r1830540]
2.16: [r1831722|http://svn.apache.org/r1831722]
2.14: [r1833731|http://svn.apache.org/r1833731]
2.12: [r1840281|http://svn.apache.org/r1840281]
2.10: [r1845927|http://svn.apache.org/r1845927]
2.8: [r1851059|http://svn.apache.org/r1851059]



> FileInputStream for workspace.xml not closed in RepositoryConfig.loadWorkspaceConfig(File)
> ------------------------------------------------------------------------------------------
>
>                 Key: JCR-4291
>                 URL: https://issues.apache.org/jira/browse/JCR-4291
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: config
>    Affects Versions: 2.17.2
>            Reporter: Jan Quadflieg
>            Assignee: Julian Reschke
>            Priority: Trivial
>             Fix For: 2.18, 2.16.2, 2.17.3, 2.14.6, 2.12.10, 2.10.9, 2.8.10
>
>         Attachments: RepositoryConfig.patch
>
>
> As already said in the summary: The FileInputStream in RepositoryConfig.loadWorkspaceConfig(File) is not closed. This open file handle prevents the repository from being deleted (we use a simple TransientRepository in unit tests which gets deleted after each test). The obvious fix is simple:
> {color:#d04437}Buggy Code:{color}
> {code:java}
> try {
>   File file = new File(directory, WORKSPACE_XML);
>   InputSource xml = new InputSource(new FileInputStream(file));
>   // ...
> } catch (FileNotFoundException e) {
>   return null;
> }
> {code}
> {color:#14892c}Fixed Code:{color}
> {code:java}
> FileInputStream fin = null;
> try {
>   File file = new File(directory, WORKSPACE_XML);
>   fin = new FileInputStream(file);
>   InputSource xml = new InputSource(fin);
>   // ...
> } catch (FileNotFoundException e) {
>   return null;
> } finally {
>   IOUtils.closeQuietly(fin);
> }
> {code}
> The attached patch file has been created from the 2.17.2 source.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)