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
/*******************************************************************************
 * Copyright (c) 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.ui.ide.dialogs;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;