Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-14634

Use try-with-resources or close classes that implement Closeable in a "finally" clause

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 14.6.0
    • None
    • None
    • Pulsar
    • Pulsar 260 - BEST, Pulsar 261 - BEST+

    Description

      Sonarqube reported several classes that implement the Closeable which are used without try-with-resources or finally clause. Update these occurrences to follow the compliant code pattern

      Connections, streams, files, and other classes that implement the Closeable interface or its super-interface, AutoCloseable, needs to be closed after use. Further, that close call must be made in a finally block otherwise an exception could keep the call from being made. Preferably, when class implements AutoCloseable, resource should be created using "try-with-resources" pattern and will be closed automatically.

      Failure to properly close resources will result in a resource leak which could bring first the application and then perhaps the box the application is on to their knees.

      Attachments

        Activity

          People

            Unassigned Unassigned
            abanck Arent-Jan Banck (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: