Uploaded image for project: 'Confluence Server'
  1. Confluence Server
  2. CONFSERVER-18093

DefaultUserProfileService tries to modify an unmodifiable collection (PATCH)

    XMLWordPrintable

    Details

    • Internal Complexity:
      1
    • Internal Value:
      4

      Description

      DefaultUserProfileServies#setServletContext relies on an implementation detail of some servlet containers that return a modifiable collection upon calling ServletContext#getResourcePaths. Since this is not guaranteed by the servlet spec a safer approach should be used as follows:

      diff -r b525e9b6e14e -r 019c14125676 apps/confluence/confluence-project/confluence/src/java/com/atlassian/confluence/user/service/DefaultUserProfileService.java
      --- a/apps/confluence/confluence-project/confluence/src/java/com/atlassian/confluence/user/service/DefaultUserProfileService.java       Fri Dec 18 23:45:51 2009 -0800
      +++ b/apps/confluence/confluence-project/confluence/src/java/com/atlassian/confluence/user/service/DefaultUserProfileService.java       Sat Dec 19 00:29:42 2009 -0800
      @@ -14,6 +14,7 @@
      
       import java.io.InputStream;
       import java.util.Set;
      +import java.util.HashSet;
      
       public class DefaultUserProfileService implements UserProfileService, ServletContextAware
       {
      @@ -55,7 +56,7 @@
           @SuppressWarnings("unchecked")
           public void setServletContext(ServletContext servletContext)
           {
      -        buildInProfilePics = servletContext.getResourcePaths(UserAccessor.PROFILE_PICTURE_BUILTIN_PATH);
      +        buildInProfilePics = new HashSet<String>(servletContext.getResourcePaths(UserAccessor.PROFILE_PICTURE_BUILTIN_PATH));
               CollectionUtils.filter(buildInProfilePics, new Predicate()
               {
                   public boolean evaluate(Object object)
      

      This patch allows Confluence 3.1 to work properly with GlassFish v3.

        Attachments

          Activity

            People

            • Assignee:
              xtjhin Joshua Tjhin (Inactive)
              Reporter:
              igorminar Igor Minar
              Participants:
              Last Touched By:
              Owen Sanico
              Reviewers:
              Andrew Lynch
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Last commented:
                8 years, 44 weeks, 1 day ago