how to catch nested exception
hello i have this code for sending mail with javamail :
try
{
//code that construct message and attachement
}
catch (AddressException e)
{
log.error("AddressException dans MailToExitAction.createAndSendMail() " + e.toString());
e.printStackTrace();
thrownew ExceptionIS2(e.getMessage());
}
catch (NoSuchProviderException e)
{
log.error("NoSuchProviderException dans MailToExitAction.createAndSendMail() " + e.toString());
e.printStackTrace();
thrownew ExceptionIS2(e.getMessage());
}
catch (MessagingException e)
{
log.error("MessagingException dans MailToExitAction.createAndSendMail() " + e.toString());
e.printStackTrace();
thrownew ExceptionIS2(e.getMessage());
}
When i m not connected to the network, i have this exception :
javax.mail.MessagingException: Could not connect to SMTP host: smtp.fr.oleane.com, port: 25;
nested exception is:
java.net.NoRouteToHostException: No route to host: connect
I would like to know how can i catch the NoRouteToHostException, cause i want a different message when i m not connected to the network ?
Thank you

