Scarab commit: svn commit: r10377 - branches/release/b21/src/webapp/WEB-INF/templates/macros/MITListMacro.vm

[email protected]
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: dabbous
Date: 2006-12-10 08:30:20-0800
New Revision: 10377

Modified:
   branches/release/b21/src/webapp/WEB-INF/templates/macros/MITListMacro.vm

Log:
sometimes th ecurrent session attribute (needed by the query matrix)
is not set (maybe due to uninitialised new sesion?)
If this happens the MITListMacro fails with a NPE.
this patch avoid the NPE and ensures the session attribute is set
correctly. note: it stll may be possible that te NPE occurs
becasue the user's current module is lost. to be checked!

Modified: branches/release/b21/src/webapp/WEB-INF/templates/macros/MITListMacro.vm
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/webapp/WEB-INF/templates/macros/MITListMacro.vm?view=diff&rev=10377&p1=branches/release/b21/src/webapp/WEB-INF/templates/macros/MITListMacro.vm&p2=branches/release/b21/src/webapp/WEB-INF/templates/macros/MITListMacro.vm&r1=10376&r2=10377
==============================================================================
--- branches/release/b21/src/webapp/WEB-INF/templates/macros/MITListMacro.vm	(original)
+++ branches/release/b21/src/webapp/WEB-INF/templates/macros/MITListMacro.vm	2006-12-10 08:30:20-0800
@@ -36,9 +36,16 @@
 
 #set ($currentModule = $scarabR.CurrentModule)
 #set ($availableAttributes = $currentModule.AllOptionAttributes)
+
 #set ($sessionAttributeKey  = "attribute_id_$currentModule.moduleId" ) 
-#set ($currentAttributeName = $scarabR.getSessionAttribute($sessionAttributeKey) )
-#set ($currentAttributeOptions = $currentModule.getAllAttributeOptions($currentAttributeName))
+#if  ($scarabR.hasSessionAttribute($sessionAttributeKey))
+    #set ($currentAttributeKey = $scarabR.getSessionAttribute($sessionAttributeKey) )
+#else
+    #set ($currentAttributeKey = $availableAttributes.get(0).AttributeId )
+    #set ($dummy = $scarabR.setSessionAttribute($sessionAttributeKey, $currentAttributeKey))
+#end
+
+#set ($currentAttributeOptions = $currentModule.getAllAttributeOptions($currentAttributeKey))
 #set ($currentRmits = $user.getAllRModuleIssueTypes($currentModule))
 #set ($savedLists = $user.MITLists)
 #set ($isMoreThanOne = $currentRmits.size() > 1)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.