Bug 24869 - GP - Eclipse crashed when entering invalid file name in FileDialog
Summary: GP - Eclipse crashed when entering invalid file name in FileDialog
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0.1   Edit
Hardware: PC Windows 2000
: P2 major (vote)
Target Milestone: 2.0.2   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-16 16:35 EDT by Duong Nguyen CLA
Modified: 2002-10-31 10:34 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duong Nguyen CLA 2002-10-16 16:35:04 EDT
When I enter \e\ for the file name in the swt FileDialog, Eclipse crashed with 
a VM exception.

STEPS:
1) Select a java file
2) Select File->Export...
3) Select JAR file and press Next
4) Press Browse... to select a Save As file dialog
5) Enter \e\ for the file name
6) Press Save

Expected result:
Should indicate that \e\ is an invalid file name.

Actual Result:
Eclipse terminated unexpectedly with the following VM exception.

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x70c02a29
Function name=PathFindExtensionW
Library=C:\WINNT\system32\SHLWAPI.DLL

Current Java thread:
	at org.eclipse.swt.internal.win32.OS.GetSaveFileNameW(Native Method)
	at org.eclipse.swt.internal.win32.OS.GetSaveFileName(OS.java:1427)
	at org.eclipse.swt.widgets.FileDialog.open(FileDialog.java:276)
	at 
org.eclipse.jdt.internal.ui.jarpackager.JarPackageWizardPage.handleDestinationBr
owseButtonPressed(JarPackageWizardPage.java:433)
	at 
org.eclipse.jdt.internal.ui.jarpackager.JarPackageWizardPage$2.widgetSelected
(JarPackageWizardPage.java:395)
	at org.eclipse.swt.widgets.TypedListener.handleEvent
(TypedListener.java:87)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1529)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1291)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:562)
	at org.eclipse.jface.window.Window.open(Window.java:542)
	at org.eclipse.ui.actions.ExportResourcesAction.run
(ExportResourcesAction.java:92)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:749)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:407)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent
(ActionContributionItem.java:361)
	at org.eclipse.jface.action.ActionContributionItem.access$0
(ActionContributionItem.java:352)
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent
(ActionContributionItem.java:47)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1529)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1291)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1256)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:1239)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:775)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:247)
	at org.eclipse.core.launcher.Main.run(Main.java:703)
	at org.eclipse.core.launcher.Main.main(Main.java:539)
Comment 1 Steve Northover CLA 2002-10-17 10:04:05 EDT
Duong, when I run the code on 98 and 2000, I get a negative array index 
exception.  I'm going to fix this and release the code, marking this PR as 
fixed.  If the GP does not go away for you, please reopen this PR.
Comment 2 Steve Northover CLA 2002-10-17 10:04:53 EDT
Fixed > 20021017
Comment 3 Grant Gayed CLA 2002-10-30 17:35:02 EST
Steve, here's a snippet that shows the GP.  You can enter any value into the 
first dialog, and entering \e\ into the second one causes the GP.  To make the 
GP go away in the example comment out the dialog.setFileName(".jar") line.

public class FileDialogFullPath {
	public static void main(String[] args) {
		Shell shell = new Shell();
		FileDialog dialog = new FileDialog(shell,SWT.SAVE);
		// the next line's presence affects the second dialog (!)
		dialog.setFileName(".jar");
		dialog.open();
		dialog = new FileDialog(shell,SWT.SAVE);
		dialog.open();
	}
}
Comment 4 Steve Northover CLA 2002-10-30 20:06:03 EST
FYI: Does not happen on Windows 98 in HEAD.
Comment 5 Steve Northover CLA 2002-10-30 21:05:08 EST
Confirmed that it GP's on Windows 2000 but not when stepping through with the 
debugger.  GG to investigate turning off the JIT.
Comment 6 Grant Gayed CLA 2002-10-31 09:58:50 EST
Released additional fix with Steve that addresses the GP.  In streams 2.0.2 and 
2.1.