Cocoon 3
  1. Cocoon 3
  2. COCOON3-46

URLConnectionUtils.closeQuietly() complains loudly if servletConnection == null

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-alpha-2
    • Fix Version/s: 3.0.0-alpha-3
    • Component/s: cocoon-pipeline
    • Labels:
      None

      Description

      finally clause in URLResponse method execute()
      contains call to URLConnectionUtils.closeQuietly.

      If servletConnection = this.url.openConnection(); fails, servletConnection is null.

      In that case closeQuietly causes a stacktrace to be output.

      Solution is if (servletConnection != null) URLConnectionUtils.closeQuietly(servletConnection);, guard the call with a test,
      or even better, take into account in closeQuietly that the input parameter may be null.

        Activity

        Hide
        Jörg Heinicke added a comment -
        Isn't it more convenient if closeQuietly(..) just handles null?
        Show
        Jörg Heinicke added a comment - Isn't it more convenient if closeQuietly(..) just handles null?
        Hide
        Steven Dolg added a comment -
        All the patch does is introduce a null check for closeQuietly(..).
        Feels like the right thing to do.

        Applied with minor formatting changes.
        Show
        Steven Dolg added a comment - All the patch does is introduce a null check for closeQuietly(..). Feels like the right thing to do. Applied with minor formatting changes.

          People

          • Assignee:
            Steven Dolg
            Reporter:
            Jos Snellings
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development