Brian, another quick question, and keep the patches coming.. Why would
you call setUser(null)? To clear out the user? Should, when you call
setUser(null) actually replace the user with an AnonymousUser...?
Otherwise, anywhere where you go data.getUser().somemethod you could get
null? Take a look at DefaultSessionValidator, it has this chunk of code:
// The user may have not logged in, so create a "guest/anonymous" user.
if (data.getUser() == null)
{
log.debug("Fixing up empty User Object!");
data.setUser(TurbineSecurity.getAnonymousUser());
data.save();
}
So you will constantly be sticking in a anonymous user.. What is the use
case you are trying to accomplish? Maybe we need an explicity method like
data.clearUser() which would do:
void clearUser(){
setUser(TurbineSecurity.getAnonymousUser());
save();
}
Eric
> -----Original Message-----
> From: Brian Lawler [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 01, 2004 8:58 AM
> To: Turbine Developers List
> Subject: Re: null pointer protection in
> DefaultTurbineRunData.setUser()...
>
>
> Hmm.. seems like the attachment wasn't allowed through. Here is the
> text of the attachment...
>
> Index:
> src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/services/
> rundata/DefaultTurbineRunData.java,v
> retrieving revision 1.16.2.1
> diff -u -r1.16.2.1 DefaultTurbineRunData.java
> ---
> src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java
> 27 Feb 2004 06:08:17 -0000
> 1.16.2.1
> +++
> src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java
> 1 Apr 2004 06:35:42 -0000
> @@ -867,7 +867,7 @@
> */
> public void setUser(User user)
> {
> - log.debug("user set: " + user.getName());
> + log.debug("user set: " + (user == null ? "null" :
> user.getName()));
> this.user = user;
> }
>
> On Mar 31, 2004, at 10:53 PM, Brian Lawler wrote:
>
> > committers-
> >
> > Please find attached a trivial patch that will prevent a null pointer
> > exception being thrown when setUser(null) is called. Is this the
> > correct way to submit these patches?
> >
> > -Brian
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]