Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-712

ExtendedProperties.save swallows instead of throws IOException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Won't Fix
    • 3.2.2
    • None
    • Properties
    • None

    Description

      commons-collections-3.2.2-src/src/java/org/apache/commons/collections/ExtendedProperties.java

      /**
       * Save the properties to the given output stream.
       * ...
       * @throws IOException if an IO error occurs - no it does not.
       */
      public synchronized void save(OutputStream output, String header) throws IOException {
      ...
      PrintWriter theWrtr = new PrintWriter(output);
      ...
      // theWrter.flush();
      // missing: if (theWrtr.checkError()) throw new IOException();

      Impact: caller cannot tell if the properties were completely saved, perhaps the disk filled up instead. Missing checkError is an antipattern for PrintWriter and PrintStream.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ph26 Philip Hodges
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: