You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Lance Norskog <go...@gmail.com> on 2013/10/21 03:58:34 UTC

A little nit: TokenStream.end() throws an IOException but does not need to

org.apache.lucene.analysis.TokenStream.end()

  public void end() throws IOException {
    clearAttributes(); // LUCENE-3849: don't consume dirty atts
    if (hasAttribute(PositionIncrementAttribute.class)) {

getAttribute(PositionIncrementAttribute.class).setPositionIncrement(0);
    }
  }


This does not need IOException.

-- 
Lance Norskog
goksron@gmail.com

Re: A little nit: TokenStream.end() throws an IOException but does not need to

Posted by Robert Muir <rc...@gmail.com>.
It does need to.

This allows a superclass to throw exception.

On Sun, Oct 20, 2013 at 9:58 PM, Lance Norskog <go...@gmail.com> wrote:
> org.apache.lucene.analysis.TokenStream.end()
>
>   public void end() throws IOException {
>     clearAttributes(); // LUCENE-3849: don't consume dirty atts
>     if (hasAttribute(PositionIncrementAttribute.class)) {
>
> getAttribute(PositionIncrementAttribute.class).setPositionIncrement(0);
>     }
>   }
>
>
> This does not need IOException.
>
> --
> Lance Norskog
> goksron@gmail.com

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