The following piece of code would help:
// This is the calling method
public void yourCallingMethod()
{
// some code ........
try {
yourCalledMethod();
}
// This catch will catch the thrown exception from the called method
catch (IOException e1) {
showStatus("Caught thrown Exception : " + e1.getMessage() );
}
}
public void yourCalledMethod()
{
//
// The following try/catch block will catch IOException and throw it again
//
try {
DataInputStream din = new DataInputStream(
new BufferedInputStream(socket.getInputStream()));
DataOutputStream dout = new DataOutputStream(
new BufferedOutputStream(socket.getOutputStream()));
}
catch(IOException e) {
showStatus("Exception caught: " + e.getMessage() );
//
// By throwing the exceptiuon again, you can have the calling method catch it.
//
throw e;
}
}