You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2014/12/31 14:46:13 UTC

[jira] [Updated] (LUCENE-6151) Remove Java 7 close() hack in OutputStreamIndexOutput

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

Uwe Schindler updated LUCENE-6151:
----------------------------------
    Description: 
In OutputStreamIndexOutput we have the following hack:

{code:java}
  @Override
  public void close() throws IOException {
    try (final OutputStream o = os) {
      // We want to make sure that os.flush() was running before close:
      // BufferedOutputStream may ignore IOExceptions while flushing on close().
      // TODO: this is no longer an issue in Java 8:
      // http://hg.openjdk.java.net/jdk8/tl/jdk/rev/759aa847dcaf
      o.flush();
    }
  }
{code}

As we are on Java 8 already in trunk, we can remove this hack. The bug was fixed in Java 8, BufferedOutputStream / FilterOutputStream always calls flush() and close(), although an error happened!

  was:
In OutputStreamIndexOutput we have the following hack:

{code:java}
  @Override
  public void close() throws IOException {
    try (final OutputStream o = os) {
      // We want to make sure that os.flush() was running before close:
      // BufferedOutputStream may ignore IOExceptions while flushing on close().
      // TODO: this is no longer an issue in Java 8:
      // http://hg.openjdk.java.net/jdk8/tl/jdk/rev/759aa847dcaf
      o.flush();
    }
  }
{code}

As we are on Java 8 already in trunk, we can remove this hack. The bug was fixed in Java 8, BufferedOutputStream always calls flush() and close(), although an error happened!


> Remove Java 7 close() hack in OutputStreamIndexOutput
> -----------------------------------------------------
>
>                 Key: LUCENE-6151
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6151
>             Project: Lucene - Core
>          Issue Type: Task
>    Affects Versions: Trunk
>            Reporter: Uwe Schindler
>             Fix For: Trunk
>
>
> In OutputStreamIndexOutput we have the following hack:
> {code:java}
>   @Override
>   public void close() throws IOException {
>     try (final OutputStream o = os) {
>       // We want to make sure that os.flush() was running before close:
>       // BufferedOutputStream may ignore IOExceptions while flushing on close().
>       // TODO: this is no longer an issue in Java 8:
>       // http://hg.openjdk.java.net/jdk8/tl/jdk/rev/759aa847dcaf
>       o.flush();
>     }
>   }
> {code}
> As we are on Java 8 already in trunk, we can remove this hack. The bug was fixed in Java 8, BufferedOutputStream / FilterOutputStream always calls flush() and close(), although an error happened!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org