Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 167374

Summary: WSDM Tooling: No proper validation done for MRT and DDE files when user defined capability/MRT is removed from MRT/DDE
Product: z_Archived Reporter: Balan Subramanian <bsubram>
Component: TPTP.monitoringAssignee: Andrew Eberbach <aeberbac>
Status: CLOSED FIXED QA Contact: Bhanu Prathap V <bhanu.prathap>
Severity: major    
Priority: P1 CC: harihnar, jacalcat
Version: unspecifiedKeywords: plan
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 169672    
Bug Blocks:    
Attachments:
Description Flags
167374 patch
none
167374 patch and error during build problem fixed
none
Patch for DDE validation if mrt is deleted none

Description Balan Subramanian CLA 2006-12-11 00:06:37 EST
1. Create a new default Capability (new_file.cap)
   2. Create a new default MRT file and select new_file.cap file in to the default mrt file (new_file.mrt)
   3. Create a new default dd file and select new_file,mrt file in to the dd file (my.dd)
   4. Remove the new_file.mcap file
   5. Now reopen the New_file.mrt file, No system defined capabilities are shown in the editor 
   6. Now reopen the my.dd file,  it throws below exception
                                        java.lang.NullPointerException
	at org.eclipse.tptp.wsdm.tooling.editor.dde.util.internal.LoaderUtil.isExists(LoaderUtil.java:243)
	at org.eclipse.tptp.wsdm.tooling.editor.dde.util.internal.LoaderUtil.synchronizeMRTandResourceType(LoaderUtil.java:205)
	at org.eclipse.tptp.wsdm.tooling.editor.dde.util.internal.LoaderUtil.loadResourceTypeTable(LoaderUtil.java:177)
	at org.eclipse.tptp.wsdm.tooling.editor.dde.util.internal.LoaderUtil.loadModel(LoaderUtil.java:85)
	at org.eclipse.tptp.wsdm.tooling.editor.dde.internal.DescriptorEditor.createPages(DescriptorEditor.java:1945)
	at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:276)
	at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:596)
	at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:372)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:566)
	at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:214)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2588)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2521)
	at org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPage.java:2513)
	at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:2498)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2493)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2478)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:388)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:350)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:275)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:139)
	at org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open(OpenActionUtil.java:49)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:190)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:174)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:267)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:243)
	at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:306)
	at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$4.open(PackageExplorerPart.java:651)
	at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:817)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:843)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149)
	at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:815)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1069)
	at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1168)
	at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:249)
	at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:243)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:283)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
	at org.eclipse.core.launcher.Main.run(Main.java:977)
	at org.eclipse.core.launcher.Main.main(Main.java:952)
Comment 1 Balan Subramanian CLA 2006-12-11 02:16:59 EST
*** Bug 167376 has been marked as a duplicate of this bug. ***
Comment 2 Hariharan L Narayanan CLA 2006-12-14 04:22:07 EST
Created attachment 55650 [details]
167374 patch
Comment 3 Andrew Eberbach CLA 2006-12-14 06:29:44 EST
After some discussion here's a suggestion. This bug should be left until later in the development cycle because the issue, while being important, is lower priority than other bugs. Also, I think that we need to handle invalid capabilities in a more robust way.

The proposed approach is to maker the individual capabilities in the MRT view as invalid with an icon and also put the capabilites that are invalid in the problems view. 

Also, later when 167574 is fixed because it will introduce a listener/notifier scheme for listening to changes in the capabilities.
Comment 4 Karthikeyan Sankaran CLA 2007-01-09 03:03:20 EST
Cannot be verified due to capablity editor blocking issue
Comment 5 Bhanu Prathap V CLA 2007-01-31 01:11:16 EST
When opening MRT file No capabilities shows up in the Manageable End Point section, below is the error log
org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Resource '/Test/new_file.mcap' does not exist.
	at org.eclipse.emf.ecore.resource.impl.URIConverterImpl$WorkbenchHelper.createPlatformResourceInputStream(URIConverterImpl.java:199)
	at org.eclipse.emf.ecore.resource.impl.URIConverterImpl.createPlatformResourceInputStream(URIConverterImpl.java:540)
	at org.eclipse.emf.ecore.resource.impl.URIConverterImpl.createInputStream(URIConverterImpl.java:449)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:897)
	at org.eclipse.tptp.wsdm.tooling.util.internal.WsdlUtils.getWSDLDefinition(WsdlUtils.java:118)
	at org.eclipse.tptp.wsdm.tooling.util.internal.WsdlUtils.getWSDLDefinition(WsdlUtils.java:93)
	at org.eclipse.tptp.wsdm.tooling.util.internal.MrtUtils.getDefinition(MrtUtils.java:136)
	at org.eclipse.tptp.wsdm.tooling.util.internal.MrtUtils.getCapabilities(MrtUtils.java:126)
	at org.eclipse.tptp.wsdm.tooling.editor.mrt.internal.NewMrtPageEditor.createPrototypePage(NewMrtPageEditor.java:176)
	at org.eclipse.tptp.wsdm.tooling.editor.mrt.internal.NewMrtPageEditor.createPages(NewMrtPageEditor.java:163)
	at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:278)
	at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:641)
	at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:411)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:566)
	at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:293)
	at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:140)
	at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:268)
	at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
	at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:394)
	at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1156)
	at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1109)
	at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1335)
	at org.eclipse.ui.internal.PartStack.add(PartStack.java:458)
	at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
	at org.eclipse.ui.internal.PartStack.add(PartStack.java:444)
	at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
	at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:65)
	at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:217)
	at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:207)
	at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:855)
	at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:754)
	at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:715)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2586)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2516)
	at org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPage.java:2508)
	at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:2493)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2488)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2472)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2463)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:638)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:597)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:285)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:138)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:195)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:176)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:268)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:244)
	at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:318)
	at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$5.open(PackageExplorerPart.java:584)
	at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:819)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:850)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:45)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:153)
	at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:817)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1078)
	at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1177)
	at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:263)
	at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:257)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:297)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:927)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3465)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3079)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2083)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2047)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:449)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:101)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:145)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:170)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:615)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:474)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:414)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1122)
Caused by: org.eclipse.core.internal.resources.ResourceException: Resource '/Test/new_file.mcap' does not exist.
	at java.lang.Throwable.<init>(Throwable.java:57)
	at java.lang.Throwable.<init>(Throwable.java:68)
	at org.eclipse.core.runtime.CoreException.<init>(CoreException.java:43)
	at org.eclipse.core.internal.resources.ResourceException.<init>(ResourceException.java:35)
	at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:310)
	at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:193)
	at org.eclipse.core.internal.resources.File.getContents(File.java:285)
	at org.eclipse.core.internal.resources.File.getContents(File.java:276)
	at org.eclipse.emf.ecore.resource.impl.URIConverterImpl$WorkbenchHelper.createPlatformResourceInputStream(URIConverterImpl.java:195)
	... 81 more
Comment 6 Bhanu Prathap V CLA 2007-01-31 01:13:51 EST
Above mentioned Comments is based on the below build
Build ID: TPTP-4.4.0-200701290100
Comment 7 Dave Smith CLA 2007-02-06 16:09:37 EST
Target to iteration 2 as per Balan's spreadsheet.
Comment 8 Bhanu Prathap V CLA 2007-02-09 00:36:42 EST
Unable to create Custom Capability, so i cannot verify this defect

Candidate Build: TPTP-4.4.0-200702050100
WTP : wtp-I-I200702011746-200702011746
Comment 9 Hariharan L Narayanan CLA 2007-02-13 08:36:03 EST
Created attachment 58851 [details]
167374 patch and error during build problem fixed
Comment 10 Balan Subramanian CLA 2007-02-16 01:18:09 EST
Patched applied to tptp cvs
Comment 11 Bhanu Prathap V CLA 2007-02-16 06:37:19 EST
1. i created mrt file with one custom capability and others are system capabilities.
1. after deleting the custom capability, when i open mrt editor, validation message shows as "Capability does not exist", Now i do not want to add any capability and continue from here but redmark shows at mrt file so i cannot proceed further.
2. after deleting the custom capability when open dd file and selecting the existing mrt file, none of the remaining capabilities shows in the capabilities section.

Build: TPTP-4.4.0-200702160321
Comment 12 Bhanu Prathap V CLA 2007-02-16 07:23:15 EST
In addition to the above comments below is the another comment
1. create new default MRT
2. Create new dd file and select MRT
3. Delete MRT and Try to open DD file error shows up as "unable to create this part due to an internal error Reason for the failure: an unexpected exception was thrown java.lang.NullPointeexception"

Build: TPTP-4.4.0-200702160321
Comment 13 Bhanu Prathap V CLA 2007-03-09 00:38:00 EST
Validation message should be shown at the time of removing capability, saying that this capability is being used my an MRT file and related dd file. still if user deletes capability i think redmark should not show on mrt file
Comment 14 Hariharan L Narayanan CLA 2007-03-09 02:44:18 EST
Created attachment 60463 [details]
Patch for DDE validation if mrt is deleted
Comment 15 Valentina Popescu CLA 2007-03-14 23:05:01 EDT
Please update target; i1 is already closed
Comment 16 Balan Subramanian CLA 2007-03-29 23:13:37 EDT
patch applied 3/16
Comment 17 Bhanu Prathap V CLA 2007-03-30 13:14:36 EDT
Verified - fixed
TPTP-4.4.0-200703300100
Comment 18 Bhanu Prathap V CLA 2007-03-30 13:14:54 EDT
Verified - fixed
TPTP-4.4.0-200703300100
Comment 19 Bhanu Prathap V CLA 2007-04-03 07:11:58 EDT
i am reopening this defect because redmark shows up on the mrt file, i think
Validation message should be shown at the time of removing capability, saying
that this capability is being used by an MRT file and related dd file. still if
user deletes capability i think redmark should not show on mrt file

Build: TPTP-4.4.0-200704020100
Comment 20 Balan Subramanian CLA 2007-04-04 01:26:39 EDT
To summarize, There are two ways to go about this,

1. Put the onus on the user to delete the capability from the MRT file that references it. In this case, the red mark should be shown. The reason for doing this is that, user may just be replacing an existing capability file with another. In this case, we don't want to unnecessarily remove the capability and have the user add it again. User should just replace current file (without deleting it first) but let's assume users may delete and replace.

2. Remove the capability from the MRT automtically and show no red mark (of course we'll show a message indicating the same). I am somehow not happy about just deleting things and we could do some complicated like ask the user if we should delete it from the MRT (instead of just informing, the dialog can actually ask a question and take input).

#1 seems to be standard Eclipse behavior - if I remove a JAR, classes of which are imported in other source file, the imports just don't go away but are marked as red. Its upto the user to go correct them.
Comment 21 jkubasta CLA 2007-04-04 19:51:48 EDT
All 4.4 defects need to be flagged P1
Comment 22 Jeff Calcaterra CLA 2007-04-12 15:26:51 EDT
I think that a popup asking the user if they want to delete the MRT file is the best approach.  If they say yes, delete it and do not show a red mark, if they do leave it there and add the red decorator.
Comment 23 Bhanu Prathap V CLA 2007-04-25 08:45:12 EDT
Verified 
Build: TPTP-4.4.0-200704250100
Comment 24 Andrew Eberbach CLA 2007-04-25 14:40:45 EDT
marking fixed
Comment 25 Andrew Eberbach CLA 2007-04-25 14:41:03 EDT
closing since verified