Details
-
Bug
-
Resolution: Won't Fix
-
Medium
-
None
-
2.5.7
-
None
-
Confluence 2.5.7, Java 1.5_10
Description
The following velocity code when run within a space plugin has been shown to show the last non-null email address in the user list for every user that has a null email address in the list only if there is at least one user in the list that has an email address and that user comes before the users with null email addresses in the list.
... <table cellspacing="0"> <thead> <tr> <th>Full Name</th> <th>Username</th> <th>Email</th> </tr> </thead> <tbody> #foreach ($user in $action.fakeUsers) #set ($userFullName = $generalUtil.htmlEncode($user.getFullName())) #set ($userName = $generalUtil.htmlEncode($user.getName())) #set ($userEmail = $user.getEmail()) <tr #if ($velocityCount % 2 == 0) class="even" #end> <td><img class="icon" src="${req.contextPath}/images/icons/user_16.gif"/>$!userFullName</td> <td>$!userName</td> <td><a href="mailto:$!userEmail" alt='$!userEmail'>$!userEmail</a></td> </tr> #end </tbody> </table> ...
The code in the action to get the users is:
import com.atlassian.user.User; import com.atlassian.user.impl.DefaultUser; ... public List getFakeUsers() { List list = new ArrayList(); list.add(getUser("user1", "this user should have an email","user1@email.com")); list.add(getUser("user2", "this user should not have an email",null)); list.add(getUser("user3", "this user should not have an email",null)); return list; } public User getUser(String userid, String fullname, String email) { DefaultUser user = new DefaultUser(); user.setName(userid); user.setFullName(fullname); user.setEmail(email); return user; } ...