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
return;
		String descriptionCharset = getCharsetFromDescription();
		if (descriptionCharset != null && !(descriptionCharset.equals(encoding))) {
			MessageDialog dialog = new MessageDialog(
					getPage().getShell(),
					IDEWorkbenchMessages
							.getString("ResourceEncodingFieldEditor.EncodingConflictTitle"), 
					null,
					IDEWorkbenchMessages
							.format(
									"ResourceEncodingFieldEditor.EncodingConflictMessage", new String[] { encoding, descriptionCharset }), 
					MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL,
							IDialogConstants.NO_LABEL }, 0); 
			if (dialog.open() > 0)
				return;
		}
		if (encoding.equals(getDefaultEnc()))
			encoding = null;
		else
			IDEEncoding.addIDEEncoding(encoding);
		final String finalEncoding = encoding;
		Job charsetJob = new Job(IDEWorkbenchMessages.getString("IDEEncoding.EncodingJob")) {
			/* (non-Javadoc)
			 * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
			 */
			protected IStatus run(IProgressMonitor monitor) {
				try {
					if (resource instanceof IContainer)
						((IContainer) resource).setDefaultCharset(finalEncoding, monitor);
					else