[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] Exception in the method I_Session.init



Hi Xavier,

Xavier Roques wrote:
> Hi,
> 
> I 'm using Xmlblaster 1.6
> 
> I implemented my own class implementing the interface I_Session
> 
> In the method 
> public String init(I_SecurityQos securityQos) throws XmlBlasterException
> I throws the exception when the user cannot connect to the server (wrong
> password ...)
> 	new XmlBlasterException (this.global
>                                , ErrorCode.USER_ILLEGALARGUMENT
>                                , ""
>                                , e.getMessage());  
> 
> All works perfectly, but it does not work for one particular case:
>    1) The client is connected to the Server A in fail safe mode with a
> specified number of retries.
>    2) The server A is stopped and restarted with another database
>    3) the client tries to connect again to the Server A but cannot
> because the database has changed and the client does
>       Not have anymore the rights to connect to the Server.
> 
> Here the problem is that the connection of the client will never die
> even if the number of retries is exceeded.
> 
> I fixed this problem by throwing the exception:
>                 throw new XmlBlasterException (this.global
>                         , ErrorCode.USER_SECURITY_AUTHENTICATION
>                         , ""
>                         , e.getMessage());    
> In the method I_Session.init (I_SecurityQos securityQos).
> 
> But with this exception, when the client invokes
> I_XmlBlasterAccess.connect it never throws an exception even if the
> password is not the good one :(
> The connection is dead OK but the client cannot know that the connection
> is refused because the password is the bad one.
> 
> So my question is "What is the good exception to throw in the method
> I_Session.init."
> 

As you did: the ErrorCode.USER_SECURITY_AUTHENTICATION is the correct
one to throw. On the client side a check is made against this exception
when the client library (the dispatcher) tries to reconnect: If this
exception is detected the connection goes to DEAD: if you have
registered a connection listener to your I_XmlBlasterAccess, the toDead
method of this listener should be invoked.

Regards
Michele

> Thanks in advance,
> 
> Xavier.
>