avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "E. Sammer (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AVRO-1249) DataFileWriter doesn't correctly conform to Closeable
Date Mon, 11 Feb 2013 03:37:12 GMT

     [ https://issues.apache.org/jira/browse/AVRO-1249?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

E. Sammer updated AVRO-1249:
----------------------------

    Release Note: DataFileWriter#close() may now be called on a writer that has already been
closed (i.e. conforms to Closeable).
    Hadoop Flags: Incompatible change
          Status: Patch Available  (was: Open)

Attaching a patch that checks if the file isOpen prior to flush/sync'ing. All tests pass (although
there are no tests of DataFileWriter, it seems). Marking as an incompatible change since it
does change the behavior of close().

I can't assign this bug to myself.
                
> DataFileWriter doesn't correctly conform to Closeable
> -----------------------------------------------------
>
>                 Key: AVRO-1249
>                 URL: https://issues.apache.org/jira/browse/AVRO-1249
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.3
>            Reporter: E. Sammer
>
> o.a.avro.file.DataFileWriter implements java.io.Closeable, but violates the contract
stated by the interface's close() method javadoc.
> {quote}
> Closes this stream and releases any system resources associated
> with it. If the stream is already closed then invoking this 
> method has no effect.
> {quote}
> DataFileWriter's close() calls flush() calls sync() which calls assertOpen(). This causes
repeated calls to close(), or those on a file that failed to open, to throw an exception which
violates the contract. Notably, the following idiom fails (and shouldn't).
> {code}
> import com.google.common.io.Closeables;
> // ...
> DataFileWriter writer = null;
> try {
>   writer = new DataFileWriter(...);
>   // ...
> } finally {
>   Closeables.closeQuietly(writer);
> }
> {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

Mime
View raw message