Bug 66480 Selecting a badly encoded file in the package explorer results in MalformedInputExceptions
I200406091200 - Create a folder with UTF-8 encoding - Have some .java files in the folder that are Latin1 encoded, but with their encoding not set (they inherit from the folder, UTF-8) (-> these files cannot be opened, which is correct) - Selecting the file in the package explorer without opening it Observe the exceptions below (actually many more, as all refactoring actions are updated). The same happens when dragging a correctly encoded file over one of the bad files, e.g. when using drag&drop refactoring. The package explorer should handle this more gracefully. !ENTRY org.eclipse.jdt.ui 4 10001 Jun 10, 2004 12:18:03.825 !MESSAGE Internal Error !STACK 1 org.eclipse.jdt.core.JavaModelException[985]: sun.io.MalformedInputException at java.lang.Throwable.<init>(Throwable.java) at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java) at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java) at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java) at java.io.InputStreamReader.read(InputStreamReader.java) at org.eclipse.jdt.internal.compiler.util.Util.getInputStreamAsCharArray(Util.java) at org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(Util.java) at org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(Util.java) at org.eclipse.jdt.internal.core.CompilationUnit.openBuffer(CompilationUnit.java:1029) at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:102) at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:183) at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java) at org.eclipse.jdt.internal.core.JavaElement.getChildren(JavaElement.java) at org.eclipse.jdt.internal.core.JavaElement.getChildrenOfType(JavaElement.java) at org.eclipse.jdt.internal.core.CompilationUnit.getTypes(CompilationUnit.java:822) at org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil.getMainType(JavaElementUtil.java) at org.eclipse.jdt.ui.actions.UseSupertypeAction.getSingleSelectedType(UseSupertypeAction.java:114) at org.eclipse.jdt.ui.actions.UseSupertypeAction.canEnable(UseSupertypeAction.java:103) at org.eclipse.jdt.ui.actions.UseSupertypeAction.selectionChanged(UseSupertypeAction.java:81) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged(SelectionDispatchAction.java) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.selectionChanged(SelectionDispatchAction.java) at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java) at org.eclipse.core.runtime.Platform.run(Platform.java) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:157) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:1388) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:694) at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:720) at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:180) at org.eclipse.jface.util.OpenStrategy.access$3(OpenStrategy.java:175) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1362) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1333) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:252) 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:272) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:128) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at java.lang.reflect.Method.invoke(Method.java:391) 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) Caused by: sun.io.MalformedInputException at java.lang.Throwable.<init>(Throwable.java) at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java) at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java) at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java) at java.io.InputStreamReader.read(InputStreamReader.java) at org.eclipse.jdt.internal.compiler.util.Util.getInputStreamAsCharArray(Util.java) at org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(Util.java) at org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(Util.java) at org.eclipse.jdt.internal.core.CompilationUnit.openBuffer(CompilationUnit.java:1029) at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:102) at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:183) at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java) at org.eclipse.jdt.internal.core.JavaElement.getChildren(JavaElement.java) at org.eclipse.jdt.internal.core.JavaElement.getChildrenOfType(JavaElement.java) at org.eclipse.jdt.internal.core.CompilationUnit.getTypes(CompilationUnit.java:822) at org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil.getMainType(JavaElementUtil.java) at org.eclipse.jdt.ui.actions.UseSupertypeAction.getSingleSelectedType(UseSupertypeAction.java:114) at org.eclipse.jdt.ui.actions.UseSupertypeAction.canEnable(UseSupertypeAction.java:103) at org.eclipse.jdt.ui.actions.UseSupertypeAction.selectionChanged(UseSupertypeAction.java:81) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged(SelectionDispatchAction.java) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.selectionChanged(SelectionDispatchAction.java) at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java) at org.eclipse.core.runtime.Platform.run(Platform.java) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:157) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:1388) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:694) at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:720) at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:180) at org.eclipse.jface.util.OpenStrategy.access$3(OpenStrategy.java:175) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1362) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1333) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:252) 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:272) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:128) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at java.lang.reflect.Method.invoke(Method.java:391) 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/actions/ActionMessages.java
public static String RefactorMenu_label;
	public static String SourceMenu_label;
	public static String BuildPath_label;
	public static String BuildAction_label;
	public static String RebuildAction_label;
	public static String SelectionConverter_codeResolveOrInput_failed;
	public static String SelectionConverter_codeResolve_failed;
	public static String OpenAction_label;
	public static String OpenAction_tooltip;
	public static String OpenAction_description;
	public static String OpenAction_declaration_label;
	public static String OpenAction_select_element;
	public static String OpenAction_error_title;
	public static String OpenAction_error_message;
	public static String OpenAction_error_messageArgs;
	public static String OpenAction_error_messageProblems;
	public static String OpenAction_error_messageBadSelection;
	public static String OpenSuperImplementationAction_label;
	public static String OpenSuperImplementationAction_tooltip;
	public static String OpenSuperImplementationAction_description;
	public static String OpenSuperImplementationAction_error_title;
	public static String OpenSuperImplementationAction_error_message;
	public static String OpenSuperImplementationAction_not_applicable;
	public static String OpenSuperImplementationAction_no_super_implementation;
	public static String OpenTypeHierarchyAction_label;
	public static String OpenTypeHierarchyAction_tooltip;
	public static String OpenTypeHierarchyAction_description;
	public static String OpenTypeHierarchyAction_dialog_title;
	public static String OpenTypeHierarchyAction_messages_title;
	public static String OpenTypeHierarchyAction_messages_no_java_element;