Bug 767263

Summary: deleting template causes resources with detached templates to throw exception
Product: [Other] RHQ Project Reporter: John Mazzitelli <mazz>
Component: Core UI, driftAssignee: Jay Shaughnessy <jshaughn>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: urgent    
Version: 4.2CC: hrupp, skondkar
Target Milestone: ---   
Target Release: RHQ 4.3.0   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 785857 (view as bug list) Environment:
Last Closed: 2013-08-31 05:55:12 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 785857    

Description John Mazzitelli 2011-12-13 11:58:21 EST
To replicate:

1) create a drift template
2) go to resource A's drift tab, create definition from that template, but detach it
3) delete the template
4) go back to the resource A's drift tab

The template is no longer in existance. But the definition was detached, so it does not get deleted. However, what should it show in the "template" column of the table? It should probably be empty. But it looks like its trying to get the name of an non-existent template

This actually is pretty bad because now I can't view the drift definitions anymore, not just for this definition, but I assume I can't see any defs, because it's the table that can't render - and the table lists all definitions.
Comment 1 John Mazzitelli 2011-12-13 12:01:06 EST
com.google.gwt.core.client.JavaScriptException:(TypeError): Cannot read property 'org_rhq_core_domain_drift_DriftDefinitionTemplate_name' of null
(TypeError): Cannot read property 'org_rhq_core_domain_drift_DriftDefinitionTemplate_name' of null
   at Unknown.org_rhq_core_domain_drift_DriftDefinitionTemplate_$getName__Lorg_rhq_core_domain_drift_DriftDefinitionTemplate_2Ljava_lang_String_2(Unknown source:0)
   at Unknown.org_rhq_enterprise_gui_coregui_client_drift_DriftDefinitionDataSource_convert__Lorg_rhq_core_domain_drift_DriftDefinitionComposite_2Lcom_smartgwt_client_widgets_grid_ListGridRecord_2(Unknown source:0)
   at Unknown.org_rhq_enterprise_gui_coregui_client_drift_DriftDefinitionDataSource_$copyValues__Lorg_rhq_enterprise_gui_coregui_client_drift_DriftDefinitionDataSource_2Lorg_rhq_core_domain_drift_DriftDefinitionComposite_2Lcom_smartgwt_client_widgets_grid_ListGridRecord_2(Unknown source:0)
   at Unknown.org_rhq_enterprise_gui_coregui_client_drift_DriftDefinitionDataSource_copyValues__Ljava_lang_Object_2Lcom_smartgwt_client_widgets_grid_ListGridRecord_2(Unknown source:0)
   at Unknown.org_rhq_enterprise_gui_coregui_client_util_RPCDataSource_copyValues__Ljava_lang_Object_2ZLcom_smartgwt_client_widgets_grid_ListGridRecord_2(Unknown source:0)
   at Unknown.org_rhq_enterprise_gui_coregui_client_util_RPCDataSource_$buildRecords__Lorg_rhq_enterprise_gui_coregui_client_util_RPCDataSource_2Ljava_util_Collection_2Z_3Lcom_smartgwt_client_widgets_grid_ListGridRecord_2(Unknown source:0)
   at Unknown.org_rhq_enterprise_gui_coregui_client_util_RPCDataSource_$buildRecords__Lorg_rhq_enterprise_gui_coregui_client_util_RPCDataSource_2Ljava_util_Collection_2_3Lcom_smartgwt_client_widgets_grid_ListGridRecord_2(Unknown source:0)
   at Unknown.org_rhq_enterprise_gui_coregui_client_util_RPCDataSource_buildRecords__Ljava_util_Collection_2_3Lcom_smartgwt_client_widgets_grid_ListGridRecord_2(Unknown source:0)
   at Unknown.org_rhq_enterprise_gui_coregui_client_drift_DriftDefinitionDataSource_$dataRetrieved__Lorg_rhq_enterprise_gui_coregui_client_drift_DriftDefinitionDataSource_2Lorg_rhq_core_domain_util_PageList_2Lcom_smartgwt_client_data_DSResponse_2Lcom_smartgwt_client_data_DSRequest_2V(Unknown source:0)
   at Unknown.org_rhq_enterprise_gui_coregui_client_drift_DriftDefinitionDataSource$9$1_onPermissionsLoaded__Ljava_util_Set_2V(Unknown source:0)
Comment 2 John Mazzitelli 2011-12-13 13:48:00 EST
git commit to master: 1c2b7c6

jay looked around and didn't find any other places where driftDef.getTemplate() is called that isn't protected from null checks so this appears to be the only place where this problem occurred.
Comment 3 Mike Foley 2011-12-13 14:58:22 EST
documenting that i am reproducing the original error (I don't have the fix yet)....   retest tomorrow.
Comment 4 Sunil Kondkar 2011-12-14 05:51:16 EST
Verified on master build#833 (Version: 4.3.0-SNAPSHOT Build Number: ee66d10)

Created a drift template and a detached definition from that template in drift tab of resource. Deleted the template, navigated back to the resource's drift tab.

 Verified that there is no exception thrown and the "template" column of detached drift definition table of the resource displays 'None'.
Comment 5 Charles Crouch 2012-01-30 14:17:30 EST
Setting target release to be RHQ4.3, since this was tested against master.