Re: Is this possible...

From: Bonj (benjtaylor)
Date: 10/18/04


Date: Mon, 18 Oct 2004 20:07:51 +0100

don't throw an exception, instead of calling log out, set it to null anyway.
Then in the finalize method, put the code that has to happen on logout, so
it will be executed anyway.

"craig" <e@mail.com> wrote in message
news:edpE9yStEHA.3984@TK2MSFTNGP09.phx.gbl...
> Thanks, Peter. I think you are right....exceptions might be the way to
> go.
>
> "Peter Rilling" <peter@nospam.rilling.net> wrote in message
> news:%23KWBdwStEHA.2536@TK2MSFTNGP11.phx.gbl...
>> No, an object cannot set itself to null.
>>
>> You could return empty values but it might be better to throw an
>> exception.
>>
>> "craig" <e@mail.com> wrote in message
>> news:ukbFpsStEHA.2864@TK2MSFTNGP09.phx.gbl...
>>> Assume that you have a User object, which abstracts an authenticated
>>> user
>> of
>>> your application. It has some properties such as UserID, FirstName,
>>> LastName, etc. and a method LogOut(); The LogOut method logs the user
>>> out
>>> of the application. If the LogOut() method is successful, the user is
>>> logged out and the User object should no longer be valid. Is there a
>>> way
>> to
>>> allow the LogOut() method to force the reference that is being held to
>>> the
>>> object to which it is a member (User) to be set to null?
>>>
>>> If not, I can force the object to return empty values for all properties
>>> after the LogOut() method has been successfully executed. But I was
>>> just
>>> wondering if it might be possible to actually blow away the object
>>> itself.
>>>
>>> Thanks!!
>>>
>>>
>>
>>
>
>



Relevant Pages

  • Re: exception inside constructors and finalize
    ... > 1.how can we handle exception inside constructors and finalize method? ... try/catch or (for constructors) throws clause - as usual. ...
    (comp.lang.java.help)
  • exception inside constructors and finalize
    ... 1.how can we handle exception inside constructors and finalize method? ... Prev by Date: ...
    (comp.lang.java.help)
  • throw exception in the finalize
    ... in vb asp.net page i'm overriding the finalize method in order to make ... cleanup. ... if i throw exception there it is not seen on the page. ... is there a way to throw exception on the finalize method in order to check ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: while c = f.read(1)
    ... The problem with interpreting empty as false is that empty ... > If Python is too "wild" for your taste, ... In that case you wouldn't return an empty sequence if you wanted ... a false value in a sequence context but would throw an exception. ...
    (comp.lang.python)
  • Re: Question about Authorization Manager
    ... They do throw an exception if an empty task is passed for a check. ... throwing an exception when the specified task contains an empty nested task ... operations that are direct children of the specified task. ...
    (microsoft.public.dotnet.security)