Bug 101619 [formatter] Formatter profiles store even though I clicked 'Cancel'
I20050624-0010 1. open the formatter preference page 2. switch from existing profile p1 to another, lets say p2 3. click 'Cancel' Expected: my formatter profile is still p1 but it is now p2.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/ProfileStore.java
* @throws CoreException
	 */
	public static void writeProfilesToFile(Collection profiles, File file) throws CoreException {
		final OutputStream writer;
		try {
			writer= new FileOutputStream(file);
			try {
				writeProfilesToStream(profiles, writer);
			} finally {
				try { writer.close(); } catch (IOException e) {  }
			}
		} catch (IOException e) {
			throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_serializing_xml_message);  
		}
	}
	
	/**
	 * Save profiles to an XML stream
	 * @param profiles List of <code>CustomProfile</code>
	 * @param stream Stream to write
	 * @throws CoreException
	 */
	private static void writeProfilesToStream(Collection profiles, OutputStream stream) throws CoreException {
		try {
			final DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
			final DocumentBuilder builder= factory.newDocumentBuilder();		
			final Document document= builder.newDocument();
			
			final Element rootElement = document.createElement(XML_NODE_ROOT);
			rootElement.setAttribute(XML_ATTRIBUTE_VERSION, Integer.toString(ProfileVersioner.CURRENT_VERSION));