Bug 284265 [JFace] DialogSettings.save() silently ignores IOException
Build ID: M20090211-1700 (Problem still in HEAD) STEPS TO REPRODUCE Call DialogSettings.save() on a Writer that produced a IOException or with a file which causes trouble during output (e.g. full drive). EXPECTED The original exception thrown by the underlying output should be propagated to the caller -- as "save() throws IOException" suggests. ACTUAL The IOException is silently ignored. ANALYSIS The internal DialogSettings.XMLWriter is based in a java.io.PrintWriter, which catches all IOExceptions.
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java
if (value != null) {
                for (int index = 0; index < value.length; index++) {
                    String string = value[index];
                    attributes.put(TAG_VALUE, string == null ? "" : string); 
                    out.printTag(TAG_ITEM, attributes, true);
                }
            }
            out.endTag(TAG_LIST);
            attributes.clear();
        }
        for (Iterator i = sections.values().iterator(); i.hasNext();) {
            ((DialogSettings) i.next()).save(out);
        }
        out.endTag(TAG_SECTION);
    }
    
    /**
     * A simple XML writer.  Using this instead of the javax.xml.transform classes allows
     * compilation against JCL Foundation (bug 80059).
     */
    private static class XMLWriter extends PrintWriter {
    	
    	protected int tab;
    	
    	protected static final String XML_VERSION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; 
    	/**
    	 * Create a new XMLWriter
    	 * @param output the stream to write the output to
    	 * @throws UnsupportedEncodingException thrown if charset is not supported
    	 */