dlr 01/08/29 22:57:59
Modified: src/java/org/apache/turbine/services/pull
TurbinePullService.java
Log:
o Session-scope tool population should only happen when we have a User
instance (to prevent NullPointerExceptions).
o Fleshed out JavaDoc of populateWithSessionTools() and changed
RunData parameter to type User (as that's the only thing that was used
in the RunData).
Revision Changes Path
1.6 +16 -11
jakarta-turbine-3/src/java/org/apache/turbine/services/pull/TurbinePullService.java
Index: TurbinePullService.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/services/pull/TurbinePullService.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -u -r1.5 -r1.6
--- TurbinePullService.java 2001/08/30 05:00:39 1.5
+++ TurbinePullService.java 2001/08/30 05:57:59 1.6
@@ -144,7 +144,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sean Legassick</a>
- * @version $Id: TurbinePullService.java,v 1.5 2001/08/30 05:00:39 dlr Exp $
+ * @version $Id: TurbinePullService.java,v 1.6 2001/08/30 05:57:59 dlr Exp $
*/
public class TurbinePullService
extends BaseService
@@ -396,12 +396,15 @@
// very similar, so the same method is used - the
// boolean parameter indicates whether get/setPerm is to be used
// rather than get/setTemp)
- populateWithSessionTools(sessionTools, context, data, false);
-
User user = data.getUser();
- if (user != null && user.hasLoggedIn())
+ if (user != null)
{
- populateWithSessionTools(persistentTools, context, data, true);
+ populateWithSessionTools(sessionTools, context, user, false);
+
+ if (user.hasLoggedIn())
+ {
+ populateWithSessionTools(persistentTools, context, user, true);
+ }
}
}
@@ -480,20 +483,22 @@
/**
* Populate the given context with the session-scope tools
*
- * @param context a TemplateContext to populate
- * @param data a RunData instance
+ * @param tools The list of tools with which to populate the
+ * session.
+ * @param context A TemplateContext to populate.
+ * @param user The <code>User</code> object whose storage to
+ * retrieve the tool from.
+ * @param userPerm Whether to retrieve the tools from the
+ * permanent storage (as opposed to the temporary storage).
*/
private void populateWithSessionTools(List tools,
TemplateContext context,
- RunData data,
+ User user,
boolean usePerm)
{
// Get the PoolService to fetch object instances from
PoolService pool = (PoolService)
TurbineServices.getInstance().getService(PoolService.SERVICE_NAME);
-
- // Get the current user
- User user = data.getUser();
// Iterate the tools
Iterator it = tools.iterator();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]