Bug 785857

Summary: deleting template causes resources with detached templates to throw exception
Product: [Other] RHQ Project Reporter: Charles Crouch <ccrouch>
Component: Core UI, driftAssignee: John Mazzitelli <mazz>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: urgent    
Version: 4.2CC: hbrock, hrupp, lzoubek, mazz, skondkar, spinder
Target Milestone: ---   
Target Release: JON 3.0.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 767263 Environment:
Last Closed: 2013-09-03 15:04:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 767263    
Bug Blocks: 782579    

Description Charles Crouch 2012-01-30 19:15:47 UTC
+++ This bug was initially created as a clone of Bug #767263 +++

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.

--- Additional comment from mazz on 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
--- STACK TRACE FOLLOWS ---
(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)

--- Additional comment from mazz on 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.

--- Additional comment from mfoley on 2011-12-13 14:58:22 EST ---

documenting that i am reproducing the original error (I don't have the fix yet)....   retest tomorrow.

--- Additional comment from skondkar on 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 2 John Mazzitelli 2012-01-30 21:08:13 UTC
git commit to release/jon3.0.x branch: ceb7b6e

Comment 3 Charles Crouch 2012-01-31 04:39:21 UTC
Switching to using MODIFIED for fixes that are in the appropriate but are waiting to get into a build.

Comment 4 Simeon Pinder 2012-02-03 15:12:29 UTC
Moving this to ON_QA as there is now a binary available to test with:
https://brewweb.devel.redhat.com//buildinfo?buildID=197202

Comment 5 Heiko W. Rupp 2013-09-03 15:04:34 UTC
Bulk closing of old issues in VERIFIED state.