mina-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Christian <a...@root1.de>
Subject Re: How to catch java.nio.channels.UnresolvedAddressException ?
Date Thu, 28 May 2009 15:06:28 GMT

On Thu, 28 May 2009 16:30:24 +0200, Emmanuel Lecharny
<elecharny@apache.org>
wrote:
> 
> 
> Well, are you sure that the log you get is not generated somwhere else ? 

Yes, I'm sure. 

> I
> see no way for java to not get through the catch( Exception e )... 

Me too. That's really a strange behaviour.

> Can you
> add a System.out.println() in the catch part of your code ?

I will try. But as the stack-trace says that this IS comming from the
connect-method I'm not sure if an sysout is telling something different.


br, 

Alex




> 
> 
>>
>> 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).
>
>
>
> On Thu, May 28, 2009 at 4:12 PM, Alexander Christian <alex@root1.de>
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.


Mime
View raw message