| Summary: | [LinkedResources] TVT36:TCT115: FRA - Advanced button not working | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | CDE Administration <cdeadmin> | ||||||||||||||||
| Component: | UI | Assignee: | Serge Beauchamp <serge> | ||||||||||||||||
| Status: | CLOSED FIXED | QA Contact: | Serge Beauchamp <serge> | ||||||||||||||||
| Severity: | normal | ||||||||||||||||||
| Priority: | P3 | CC: | camle, kitlo, pawel.pogorzelski1, Szymon.Brandys | ||||||||||||||||
| Version: | 3.6 | Flags: | Szymon.Brandys:
review+
pawel.pogorzelski1: review+ |
||||||||||||||||
| Target Milestone: | 3.6 RC2 | ||||||||||||||||||
| Hardware: | PC | ||||||||||||||||||
| OS: | Windows XP | ||||||||||||||||||
| URL: | 115 | ||||||||||||||||||
| Whiteboard: | |||||||||||||||||||
| Attachments: |
|
||||||||||||||||||
|
Description
CDE Administration
Created attachment 167003 [details]
08.000.280_AdvanceButtonNotWorking.gif
<cde:tctdetail> Testcase: 08.000.280 - DTP - NEW SQL FILE DIALOG/WINDOWS Project: WSW36 Component: Xfer - Data Tools/SQL Editor Framework Priority: 2 Subject: FRA - Advanced button not working Article ID: 115 Originator: mmarin@fr.ibm.com </cde:tctdetail> This appears to be a Eclipse platform bug. The code where the NPE is thrown is in the org.eclipse.ui.ide plugin, in the CreateLinkedResourceGroup class.
The constructor for the class allows a null to be passed as the "updatableResourceName" parameter, as shown here:
/**
* Creates a link target group
*
* @param type
* specifies the type of resource to link to.
* <code>IResource.FILE</code> or <code>IResource.FOLDER</code>
* @param listener
* listener to notify when one of the widgets' value is changed.
* @param updatableResourceName
* an updatable string value that will be updated to reflect the
* link target's last segment, or <code>null</code>. Updating
* will only happen if the current value of that string is null
* or the empty string, or if it has not been changed since the
* last time it was updated.
*/
public CreateLinkedResourceGroup(int type, Listener listener,
IStringValue updatableResourceName) {
this.type = type;
this.listener = listener;
this.updatableResourceName = updatableResourceName;
if (updatableResourceName != null) {
lastUpdatedValue = updatableResourceName.getValue();
}
}
However, code further on, in the "resolveVariable" method does not check for a null before trying to use the variable, as shown here:
/**
* Tries to resolve the value entered in the link target field as a
* variable, if the value is a relative path. Displays the resolved value if
* the entered value is a variable.
*/
private void resolveVariable() {
IPathVariableManager pathVariableManager;
// use the resolved link target name
if (updatableResourceName.getResource() != null)
pathVariableManager = updatableResourceName.getResource().getPathVariableManager();
else
pathVariableManager = ResourcesPlugin
.getWorkspace().getPathVariableManager();
boolean isURL = true;
etc....
I would think somebody else would have already found and reported this bug on the platform, but I did a Bugzilla search on bugs with "CreateLinkedResourceGroup" or "resolveVariable" in the title but did not find anything.
Here's the exception traceback that occurs when the Advanced button on the New SQL File wizard page is clicked: !ENTRY org.eclipse.ui 4 0 2010-05-10 14:02:07.296 !MESSAGE Unhandled event loop exception !STACK 0 java.lang.NullPointerException at org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup.resolveVariable(CreateLinkedResourceGroup.java:562) at org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup.access$2(CreateLinkedResourceGroup.java:559) at org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup$2.modifyText(CreateLinkedResourceGroup.java:277) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:173) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1076) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057) at org.eclipse.swt.widgets.Text.wmCommandChild(Text.java:2526) at org.eclipse.swt.widgets.Control.WM_COMMAND(Control.java:4296) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4162) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4873) at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2362) at org.eclipse.swt.widgets.Text.callWindowProc(Text.java:255) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4250) at org.eclipse.swt.widgets.Text.windowProc(Text.java:2170) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4873) at org.eclipse.swt.internal.win32.OS.SetWindowTextW(Native Method) at org.eclipse.swt.internal.win32.OS.SetWindowText(OS.java:3318) at org.eclipse.swt.widgets.Text.setText(Text.java:1961) at org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup.createLinkLocationGroup(CreateLinkedResourceGroup.java:327) at org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup.createContents(CreateLinkedResourceGroup.java:208) at org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup.createContents(CreateLinkedResourceGroup.java:157) at org.eclipse.datatools.sqltools.common.ui.resource.WizardNewFileCreationPage.handleAdvancedButtonSelect(WizardNewFileCreationPage.java:496) at org.eclipse.datatools.sqltools.common.ui.resource.WizardNewFileCreationPage$1.widgetSelected(WizardNewFileCreationPage.java:158) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657) at org.eclipse.jface.window.Window.runEventLoop(Window.java:825) at org.eclipse.jface.window.Window.open(Window.java:801) at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:254) at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:274) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169) at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241) at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2601) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2565) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2399) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:669) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:662) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:600) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574) at org.eclipse.equinox.launcher.Main.run(Main.java:1407) at org.eclipse.equinox.launcher.Main.main(Main.java:1383) Here's the Eclipse projects needed to set up a DTP (Helios) environment to recreate this problem: - Eclipse platform (v3.6) - EMF (org.eclipse.emf.ecore) (v2.5.0) - GEF (v3.5.2) - DTP (v1.8) Created attachment 167831 [details]
Patch for NPE in CreateLinkedResourceGroup in plugin org.eclipse.ui.ide
Added a simple patch that avoids the NPE and allows the Advanced button to work. The patch is fine, thanks. Do you want me to flag my review and commit it yourself, or for me to commit it after your review flag set? Hi Serge, I'm not sure if your comment is addressed to me... If so, please commit the change, since I am not a committer on the component in question. No problem, I'll ask Szymon to review it. I found another way to blow up the Advanced button. Steps: 1) Open the NewFile wizard 2) Clear 'Enter or select the parent folder:' 3) Click 'Advanced' It used to work in 3.5. Created attachment 168360 [details] Additional fix (In reply to comment #11) > I found another way to blow up the Advanced button. > > Steps: > 1) Open the NewFile wizard > 2) Clear 'Enter or select the parent folder:' > 3) Click 'Advanced' > > It used to work in 3.5. Now fixed with this patch. I compared the fix with WizardNewFolderMainPage#createAdvancedControls line 212. In WizardNewFolderMainPage, around line 203 always a non-null resource is returned. WizardNewFileCreationPage with the fix may return null, if the file name is empty. I noticed that later the returned resource is used to find Path Variable Manager, so when null is returned, the result may be inappropriate. (In reply to comment #13) > I compared the fix with WizardNewFolderMainPage#createAdvancedControls line > 212. > > In WizardNewFolderMainPage, around line 203 always a non-null resource is > returned. WizardNewFileCreationPage with the fix may return null, if the file > name is empty. > I noticed that later the returned resource is used to find Path Variable > Manager, so when null is returned, the result may be inappropriate. Hi, First, returning null is proper for that interface definition, and it is handled properly by the caller (see CreateLinkedResourceGroup#getPathVariableManager(). So with this new patch, the WizardNewFolderMainPage now behaves the same way (return null) when the string is empty - it used to return the IWorkspace as the IResource, which ends up being interpreted the same way as null - but null is less misleading. Created attachment 168891 [details]
Final patch
Can you please review it? Thanks.
Created attachment 168918 [details]
Patch
once more, with correction by Szymon
Looks good. Just the copyright date should be updated. Thanks, now fixed on head. <response_by> rewagner at 2010.05.25.14.54.00 </response_by> I am having trouble with this button. Whenever I click it, at first nothing happens, but when I resize the dialog window, the checkbox to Link to file in file system and the other stuff shows up. But also if I click Advanced multiple times, it adds those things again and again. Is this how its supposed to work? I'm guessing no. I'll attach a screen shot to show you what I see. Thanks, Ross Created attachment 169892 [details]
New_SQL_File_dialog_error.GIF
(In reply to comment #19) > <response_by> rewagner at 2010.05.25.14.54.00 </response_by> > I am having trouble with this button. Whenever I click it, at first nothing > happens, but when I resize the dialog window, the checkbox to Link to file in > file system and the other stuff shows up. But also if I click Advanced > multiple times, it adds those things again and again. Is this how its supposed > to work? I'm guessing no. I'll attach a screen shot to show you what I see. > > Thanks, > Ross I'm not able to reproduce this with the normal 'New File Wizard', but you are using the 'New SQL File' wizard. What plugins do I need to install to be able to reproduce it? (In reply to comment #21) > What plugins do I need to install to be able to reproduce it? Data Tools from the Helios update site. Created attachment 169999 [details]
Potential cause
I can see the same problem on the latest IBuild with Data Tools installed. It was introduced by the fix for bug 312888. I opened bug 314475 scheduled for 3.6 RC3 to address the problem. <response_by> martine marin at 2010.06.01.06.21.39 </response_by> Pb fixed in build 20100529-2200 for the testcase mentionned File > New > Other >SQL Development >SQL File. Closing Thanks, Martine <response_by> Katia Milekhina at 2010.06.03.02.22.24 </response_by> Fixed for Russia in the build 20100602. Thanks, Katia |