Extend try-catch clause to include possible occurrence of IOException or

SocketException.
fix-message-formatting
Danny van Heumen 12 years ago
parent d95e70727d
commit 6a51e860ee

@ -6,6 +6,7 @@
*/
package net.java.sip.communicator.impl.protocol.irc;
import java.io.*;
import java.util.*;
import net.java.sip.communicator.impl.protocol.irc.ModeParser.ModeEntry;
@ -159,43 +160,42 @@ private void connectSynchronized() throws Exception
synchronized (result)
{
// start connecting to the specified server ...
// TODO Catch IOException/SocketException in case of early failure
// in call to connect()
this.irc.connect(this.params, new Callback<IIRCState>()
try
{
@Override
public void onSuccess(IIRCState state)
this.irc.connect(this.params, new Callback<IIRCState>()
{
synchronized (result)
@Override
public void onSuccess(IIRCState state)
{
LOGGER.trace("IRC connected successfully!");
result.setDone(state);
result.notifyAll();
synchronized (result)
{
LOGGER.trace("IRC connected successfully!");
result.setDone(state);
result.notifyAll();
}
}
}
@Override
public void onFailure(Exception e)
{
synchronized (result)
@Override
public void onFailure(Exception e)
{
LOGGER.trace("IRC connection FAILED! ("
+ e.getMessage() + ")");
result.setDone(e);
result.notifyAll();
synchronized (result)
{
LOGGER.trace("IRC connection FAILED! ("
+ e.getMessage() + ")");
result.setDone(e);
result.notifyAll();
}
}
}
});
});
try
{
while (!result.isDone())
{
LOGGER
.trace("Waiting for the connection to be established ...");
result.wait();
}
this.connectionState = result.getValue();
// TODO Implement connection timeout and a way to recognize that
// the timeout occurred.
@ -217,6 +217,12 @@ public void onFailure(Exception e)
throw e;
}
}
catch (IOException e)
{
this.provider
.setCurrentRegistrationState(RegistrationState.UNREGISTERED);
throw e;
}
catch (InterruptedException e)
{
this.provider

Loading…
Cancel
Save