You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Guangtai Liang (JIRA)" <ji...@codehaus.org> on 2012/02/22 14:14:03 UTC

[jira] (DOXIA-463) An incomplete fix for the resource leak bugs in XdocBookRenderer.java

Guangtai Liang created DOXIA-463:
------------------------------------

             Summary: An incomplete fix for the resource leak bugs in XdocBookRenderer.java
                 Key: DOXIA-463
                 URL: https://jira.codehaus.org/browse/DOXIA-463
             Project: Maven Doxia
          Issue Type: Bug
            Reporter: Guangtai Liang
            Priority: Critical


The fix revision 740164 was aimed to remove resource leak bugs on the Writer object "writer" (created in line 177) in the method "writeBookIndex"of the file "/maven/doxia/doxia/trunk/doxia-
book/src/main/java/org/apache/maven/doxia/book/services/renderer/XdocBookRenderer.java" , but it is incomplete. 

There are some problems: 
1. when the statements at lines 177 throw some exception, "writer" will be leaked. 

The best way to close such resource objects is putting such close operations for all resource objects in the finaly block of a try-catch-finally structure and then putting all other code in a try block.

The problem still exists in the head revision (when the statements at line 171 throws some exception, "writer" will be leaked). The buggy code is copied as bellows:

private void writeBookIndex( File index, BookModel book, BookContext context )
        throws IOException
    {
169        Writer writer = WriterFactory.newXmlWriter( index );

171        XdocSink sink = new IndexXdocBookSink( writer, context.getIndex().getFirstEntry(), i18n, 

context.getLocale() );

        try
        {
            ......
            sink.body_();
        }
        finally
        {
211            sink.flush();

213            sink.close();

215            IOUtil.close( writer );
        }
    }


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

        

[jira] (DOXIATOOLS-30) An incomplete fix for the resource leak bugs in XdocBookRenderer.java

Posted by "Dennis Lundberg (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/DOXIATOOLS-30?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dennis Lundberg updated DOXIATOOLS-30:
--------------------------------------

    Component/s: Book
    
> An incomplete fix for the resource leak bugs in XdocBookRenderer.java
> ---------------------------------------------------------------------
>
>                 Key: DOXIATOOLS-30
>                 URL: https://jira.codehaus.org/browse/DOXIATOOLS-30
>             Project: Maven Doxia Tools
>          Issue Type: Bug
>          Components: Book
>            Reporter: Guangtai Liang
>            Priority: Critical
>
> The fix revision 740164 was aimed to remove resource leak bugs on the Writer object "writer" (created in line 177) in the method "writeBookIndex"of the file "/maven/doxia/doxia/trunk/doxia-
> book/src/main/java/org/apache/maven/doxia/book/services/renderer/XdocBookRenderer.java" , but it is incomplete. 
> There are some problems: 
> 1. when the statements at lines 177 throw some exception, "writer" will be leaked. 
> The best way to close such resource objects is putting such close operations for all resource objects in the finaly block of a try-catch-finally structure and then putting all other code in a try block.
> The problem still exists in the head revision (when the statements at line 171 throws some exception, "writer" will be leaked). The buggy code is copied as bellows:
> private void writeBookIndex( File index, BookModel book, BookContext context )
>         throws IOException
>     {
> 169        Writer writer = WriterFactory.newXmlWriter( index );
> 171        XdocSink sink = new IndexXdocBookSink( writer, context.getIndex().getFirstEntry(), i18n, 
> context.getLocale() );
>         try
>         {
>             ......
>             sink.body_();
>         }
>         finally
>         {
> 211            sink.flush();
> 213            sink.close();
> 215            IOUtil.close( writer );
>         }
>     }

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

        

[jira] (DOXIATOOLS-30) An incomplete fix for the resource leak bugs in XdocBookRenderer.java

Posted by "Dennis Lundberg (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/DOXIATOOLS-30?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dennis Lundberg moved DOXIA-463 to DOXIATOOLS-30:
-------------------------------------------------

        Key: DOXIATOOLS-30  (was: DOXIA-463)
    Project: Maven Doxia Tools  (was: Maven Doxia)
    
> An incomplete fix for the resource leak bugs in XdocBookRenderer.java
> ---------------------------------------------------------------------
>
>                 Key: DOXIATOOLS-30
>                 URL: https://jira.codehaus.org/browse/DOXIATOOLS-30
>             Project: Maven Doxia Tools
>          Issue Type: Bug
>            Reporter: Guangtai Liang
>            Priority: Critical
>
> The fix revision 740164 was aimed to remove resource leak bugs on the Writer object "writer" (created in line 177) in the method "writeBookIndex"of the file "/maven/doxia/doxia/trunk/doxia-
> book/src/main/java/org/apache/maven/doxia/book/services/renderer/XdocBookRenderer.java" , but it is incomplete. 
> There are some problems: 
> 1. when the statements at lines 177 throw some exception, "writer" will be leaked. 
> The best way to close such resource objects is putting such close operations for all resource objects in the finaly block of a try-catch-finally structure and then putting all other code in a try block.
> The problem still exists in the head revision (when the statements at line 171 throws some exception, "writer" will be leaked). The buggy code is copied as bellows:
> private void writeBookIndex( File index, BookModel book, BookContext context )
>         throws IOException
>     {
> 169        Writer writer = WriterFactory.newXmlWriter( index );
> 171        XdocSink sink = new IndexXdocBookSink( writer, context.getIndex().getFirstEntry(), i18n, 
> context.getLocale() );
>         try
>         {
>             ......
>             sink.body_();
>         }
>         finally
>         {
> 211            sink.flush();
> 213            sink.close();
> 215            IOUtil.close( writer );
>         }
>     }

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