Details

    • Type: Wish Wish
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Implemented
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      public static void closeAllQuietly(Closeable... closables) {
      for (Closeable closable : closables)

      { closeQuietly(closable); }

      }

        Activity

        Hide
        Sebb added a comment -

        There is already a method which does that:

        IOUtils#closeQuietly(final Closeable... closeables)

        Show
        Sebb added a comment - There is already a method which does that: IOUtils#closeQuietly(final Closeable... closeables)
        Hide
        Mikhail Mazursky added a comment -

        It's a bad idea to provide such method - as practice shows it is very often misused. Take a look at the discussion here https://code.google.com/p/guava-libraries/issues/detail?id=1118

        Show
        Mikhail Mazursky added a comment - It's a bad idea to provide such method - as practice shows it is very often misused. Take a look at the discussion here https://code.google.com/p/guava-libraries/issues/detail?id=1118
        Hide
        Sebb added a comment - - edited

        Or perhaps overload the existing method:

        public static void closeQuietly(final Closeable ... closeables) {
            if (closeables == null) { // avoid NPE if array is null
                return;
            }
            for(Closeable closeable : closeables) {
                closeQuietly(closeable);
            }
        }
        
        Show
        Sebb added a comment - - edited Or perhaps overload the existing method: public static void closeQuietly( final Closeable ... closeables) { if (closeables == null ) { // avoid NPE if array is null return ; } for (Closeable closeable : closeables) { closeQuietly(closeable); } }

          People

          • Assignee:
            Unassigned
            Reporter:
            BELUGA BEHR
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development