Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-5259

convert analysis consumers to try-with-resources

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.6, 6.0
    • None
    • None
    • New

    Description

      Most of these consumers' exception handling is questionable at best.

      if you do it with try-with-resources, then its obvious its correct:

      try (TokenStream stream = analyzer.tokenStream("body", "testing")) {
        stream.reset();
        while (stream.incrementToken()) {
          ...
        }
        stream.end();
      }
      

      For trunk we should change the consumers to work this way. For 4.x we can simulate it with IOUtils

      Attachments

        1. LUCENE-5259.patch
          118 kB
          Robert Muir

        Activity

          People

            Unassigned Unassigned
            rcmuir Robert Muir
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: