On Thu, May 28, 2009 at 4:12 PM, Alexander Christian <[email protected]> wrote:

>
> Sorry, this does not work.
> Here's my changed sample code:
>
> ----
> 468: ConnectFuture future = null;
> 469: try {
> 470:        future = connector.connect(new InetSocketAddress(host, port));
> 471:        future.awaitUninterruptibly();
> 472: } catch (Exception e){
> 473:        throw new EstablishConnectionFailed("Can't connect due to
> unresolved socket address. host="+host+" port="+port+" error:
> "+e.getMessage());
> 474: }
> ----
>
> And the exception:
> ----
> Exception in thread "main" java.nio.channels.UnresolvedAddressException
>        at sun.nio.ch.Net.checkAddress(Unknown Source)
>        at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
>        at
>
> org.apache.mina.transport.socket.nio.NioSocketConnector.connect(NioSocketConnector.java:188)
>        at
>
> org.apache.mina.transport.socket.nio.NioSocketConnector.connect(NioSocketConnector.java:46)
>        at
>
> org.apache.mina.core.polling.AbstractPollingIoConnector.connect0(AbstractPollingIoConnector.java:324)
>        at
>
> org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:256)
>        at
>
> org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:173)
>         at de.root1.simon.Simon.lookup(Simon.java:470) <---- This is the
> line in
> which the exception occurs
>        at de.root1.simon.Simon.lookup(Simon.java:322)
>        at SampleClient.main(SampleClient.java:86)
> ----
>
>
> As you can see: The exception is is thrown at line 470, which is the line
> with the connect() call. And the exception is not caught. So it's not up to
> future.awaitUninterruptibly() to throw the exception.


Well, are you sure that the log you get is not generated somwhere else ? I
see no way for java to not get through the catch( Exception e )... Can you
add a System.out.println() in the catch part of your code ?


>
> Maybe you forgot that this only happens in case of a network problem, as i
> described in my last mail.

No, the exception wasn't necessarily  produced by the connect() part. (at
least, this is what I though, as I don't have access to the current code at
the office).


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to