Bug 64672 Code Formatter Preferences Page Broken - NPE
I200405290105 Selecting the Code Formatter Prefs Page results in an error dialog and NPE: !MESSAGE Plug-in "org.eclipse.jdt.ui" was unable to instantiate class "org.eclipse.jdt.internal.ui.preferences.CodeFormatterPreferencePage". !STACK 0 java.lang.NullPointerException at org.apache.xalan.serialize.SerializerToXML.writeAttrString(Unknown Source) at org.apache.xalan.serialize.SerializerToXML.processAttribute(Unknown Source) at org.apache.xalan.serialize.SerializerToXML.startElement(Unknown Source) at org.apache.xalan.transformer.TransformerIdentityImpl.startElement (Unknown Source) at org.apache.xml.utils.TreeWalker.startNode(Unknown Source) at org.apache.xml.utils.TreeWalker.traverse(Unknown Source) at org.apache.xalan.transformer.TransformerIdentityImpl.transform (Unknown Source) at org.eclipse.jdt.internal.ui.preferences.formatter.ProfileStore.writeProfilesToS tream(ProfileStore.java:296) at org.eclipse.jdt.internal.ui.preferences.formatter.ProfileStore.writeProfiles (ProfileStore.java:148) at org.eclipse.jdt.internal.ui.preferences.formatter.ProfileStore.readOldForCompat ibility(ProfileStore.java:200) at org.eclipse.jdt.internal.ui.preferences.formatter.ProfileStore.readProfiles (ProfileStore.java:140) at org.eclipse.jdt.internal.ui.preferences.formatter.CodingStyleConfigurationBlock .<init>(CodingStyleConfigurationBlock.java:347) at org.eclipse.jdt.internal.ui.preferences.CodeFormatterPreferencePage.<init> (CodeFormatterPreferencePage.java:44) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtensi on(ConfigurationElement.java:141) at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtensi on(ConfigurationElement.java:124) at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtensi on(ConfigurationElement.java:113) at org.eclipse.ui.internal.WorkbenchPlugin.createExtension (WorkbenchPlugin.java:180) at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceNode.createPage (WorkbenchPreferenceNode.java:60) at org.eclipse.jface.preference.PreferenceDialog.showPage (PreferenceDialog.java:984) at org.eclipse.jface.preference.PreferenceDialog$8.selectionChanged (PreferenceDialog.java:529) at org.eclipse.jface.viewers.StructuredViewer$3.run (StructuredViewer.java:452) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:615) at org.eclipse.core.runtime.Platform.run(Platform.java:758) at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged (StructuredViewer.java:450) at org.eclipse.jface.viewers.StructuredViewer.handlePostSelect (StructuredViewer.java:710) at org.eclipse.jface.viewers.StructuredViewer$5.widgetSelected (StructuredViewer.java:728) at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent (OpenStrategy.java:200) at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:195) at org.eclipse.jface.util.OpenStrategy$3.run(OpenStrategy.java:349) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:106) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2693) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2385) at org.eclipse.jface.window.Window.runEventLoop(Window.java:668) at org.eclipse.jface.window.Window.open(Window.java:648) at org.eclipse.ui.internal.OpenPreferencesAction.run (OpenPreferencesAction.java:72) at org.eclipse.jface.action.Action.runWithEvent(Action.java:881) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:915) at org.eclipse.jface.action.ActionContributionItem.access$2 (ActionContributionItem.java:866) at org.eclipse.jface.action.ActionContributionItem$7.handleEvent (ActionContributionItem.java:785) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2716) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2382) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1363) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1334) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:253) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:96) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:334) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:128) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:638) at org.eclipse.core.launcher.Main.main(Main.java:622)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/ProfileStore.java
} catch (SAXException e) {
			throw createException(e, FormatterMessages.getString("CodingStyleConfigurationBlock.error.reading_xml.message"));  
		} catch (IOException e) {
			throw createException(e, FormatterMessages.getString("CodingStyleConfigurationBlock.error.reading_xml.message"));  
		} catch (ParserConfigurationException e) {
			throw createException(e, FormatterMessages.getString("CodingStyleConfigurationBlock.error.reading_xml.message"));  
		}
		return handler.getProfiles();
	}
	
	/**
	 * Write the available profiles to the internal XML file.
	 */
	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.getString("CodingStyleConfigurationBlock.error.serializing_xml.message"));  
		}
	}
	
	/**
	 * Save profiles to an XML stream
	 */