UserInfoService (Recently added) is not working properly
--------------------------------------------------------

                 Key: PLUTO-324
                 URL: https://issues.apache.org/jira/browse/PLUTO-324
             Project: Pluto
          Issue Type: Bug
          Components: portlet container
    Affects Versions: 1.1.1
            Reporter: Charles Severance


Several simple mistakes in UserInfo code - in particular can lead to NPE.  
Sorry for the spam - Patch inline :)

charles-severances-computer:~/dev/pluto-1.1/pluto-trunk csev$ svn diff
Index: 
pluto-container/src/main/java/org/apache/pluto/core/DefaultUserInfoService.java
===================================================================
--- 
pluto-container/src/main/java/org/apache/pluto/core/DefaultUserInfoService.java 
    (revision 513345)
+++ 
pluto-container/src/main/java/org/apache/pluto/core/DefaultUserInfoService.java 
    (working copy)
@@ -32,7 +32,12 @@
     private Map userInfoMap = new HashMap();
 
     public Map getUserInfo(PortletRequest request) throws 
PortletContainerException {
-        return (Map)userInfoMap.get(request.getRemoteUser());
+       Map retval = null;
+       if ( request.getRemoteUser() != null ) {
+            retval= (Map)userInfoMap.get(request.getRemoteUser());
+       } 
+       if ( retval == null ) retval = new HashMap();
+        return retval;
     }
 
     public void setUserInfo(String userName, Map userInfoMap) {
Index: 
pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java
===================================================================
--- 
pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java
   (revision 513345)
+++ 
pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java
   (working copy)
@@ -55,6 +55,7 @@
         portletEnvironmentService = new DefaultPortletEnvironmentService();
         portletInfoService = new DefaultPortletInfoService();
         portalAdministrationService = new DefaultPortalAdministrationService();
+        userInfoService = new DefaultUserInfoService();
     }
     
     /**
@@ -93,6 +94,10 @@
             portalAdministrationService = 
root.getPortalAdministrationService();
         }
 
+        if(root.getUserInfoService() != null) {
+            userInfoService = root.getUserInfoService();
+        }
+
     }
     
     
@@ -127,8 +132,5 @@
         return userInfoService;
     }
 
-    public void setUserInfoService(UserInfoService userInfoService) {
-        this.userInfoService = userInfoService;
-    }
 }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to