You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Philip Hodges (JIRA)" <ji...@apache.org> on 2019/03/18 14:44:00 UTC

[jira] [Updated] (COLLECTIONS-712) ExtendedProperties.save swallows instead of throws IOException

     [ https://issues.apache.org/jira/browse/COLLECTIONS-712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Philip Hodges updated COLLECTIONS-712:
--------------------------------------
    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);
 // ... after 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.

  was:
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);
// ... after theWrter.flush(); missing if (theWrtr.errorCheck()) throw new IOException();

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

        Summary: ExtendedProperties.save swallows instead of throws IOException  (was: ExtendedProperties.save swallows instead of throwing IOException)

> ExtendedProperties.save swallows instead of throws IOException
> --------------------------------------------------------------
>
>                 Key: COLLECTIONS-712
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-712
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Properties
>    Affects Versions: 3.2.2
>            Reporter: Philip Hodges
>            Priority: Trivial
>
> 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);
>  // ... after 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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)