Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-4037

Closing autoCloseable resource with try-with-resources block

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.8.0
    • Component/s: server

      Description

      Using

                  try (FileInputStream in = new FileInputStream(configFile)) {
                      ...
                      configFileStr = path;
                  }
      

      replace

                  FileInputStream in = new FileInputStream(configFile);
                  try {
                      ...
                  } finally {
                      in.close();
                  }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                lan_ok LiAoNan
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h