Bug 82248 [Encoding] NullPointerException when changing file encoding
build: eclipse-SDK-I20041221-0800-win32 testcase: - open a plugin.xml file in Text Editor - select File>Conversion>Change Encoding... - change encoding from UTF-8 to UTF-16 - NullPointerException java.lang.NullPointerException at org.eclipse.ui.ide.dialogs.ResourceEncodingFieldEditor.doStore (ResourceEncodingFieldEditor.java:100) at org.eclipse.ui.ide.dialogs.ResourceEncodingFieldEditor.store (ResourceEncodingFieldEditor.java:149) at org.eclipse.ui.texteditor.ChangeEncodingAction$1.apply (ChangeEncodingAction.java:167) at org.eclipse.ui.texteditor.ChangeEncodingAction$1.okPressed (ChangeEncodingAction.java:162) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:396) at org.eclipse.ui.texteditor.ChangeEncodingAction$1.buttonPressed (ChangeEncodingAction.java:155) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:543) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2809) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2454) at org.eclipse.jface.window.Window.runEventLoop(Window.java:718) at org.eclipse.jface.window.Window.open(Window.java:696) at org.eclipse.ui.texteditor.ChangeEncodingAction.run (ChangeEncodingAction.java:175) at org.eclipse.ui.texteditor.RetargetTextEditorAction.run (RetargetTextEditorAction.java:237) at org.eclipse.jface.action.Action.runWithEvent(Action.java:989) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:555) at org.eclipse.jface.action.ActionContributionItem.access$2 (ActionContributionItem.java:505) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent (ActionContributionItem.java:419) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2809) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2454) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1569) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1540) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:285) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:220) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:129) 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:710) at org.eclipse.core.launcher.Main.main(Main.java:694)
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/dialogs/ResourceEncodingFieldEditor.java
setPresentsDefaultValue(true);
		doLoadDefault();
		refreshValidState();
	}
	/* (non-Javadoc)
	 * @see org.eclipse.ui.ide.dialogs.AbstractEncodingFieldEditor#findDefaultEncoding()
	 */
	protected String findDefaultEncoding() {
		if (resource instanceof IWorkspaceRoot)
			return super.findDefaultEncoding();
		String defaultCharset = getCharsetFromDescription();
		defaultCharset = getCharsetFromDescription();
		if (defaultCharset != null && defaultCharset.length() > 0)
			return defaultCharset;
		try {
			
			defaultCharset = resource.getParent().getDefaultCharset(true);
		} catch (CoreException exception) {
			
		}
		if (defaultCharset != null && defaultCharset.length() > 0)
			return defaultCharset;
		return super.findDefaultEncoding();
	}
	/**
	 * Get the charset from the content description if there is one.
	 * @return String or <code>null</code>.
	 */
	private String getCharsetFromDescription() {
		IContentDescription description = getContentDescription();