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

convert analysis consumers to try-with-resources

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.6, 6.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: