mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-13 20:15:22 +02:00
[270777][cleanup] Improve try..catch construct
This commit is contained in:
parent
654cf929b5
commit
a941b54180
1 changed files with 43 additions and 44 deletions
|
@ -287,20 +287,19 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
|
|||
_connectorServicePool.waitUntilNotContained(connectorService);
|
||||
}
|
||||
else {
|
||||
final Display dis = Display.getDefault();
|
||||
_connectorServicePool.add(connectorService);
|
||||
|
||||
Display dis = Display.getDefault();
|
||||
try
|
||||
{
|
||||
PromptForPassword prompter = new PromptForPassword(ss);
|
||||
dis.syncExec(prompter);
|
||||
if (prompter.isCancelled()) {
|
||||
SystemMessage cancelledMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_CANCELLED);
|
||||
SystemMessageObject cancelledMessageObject = new SystemMessageObject(cancelledMessage, ISystemMessageObject.MSGTYPE_CANCEL, _remoteObject);
|
||||
SystemMessageObject cancelledMessageObject = new SystemMessageObject(cancelledMessage, ISystemMessageObject.MSGTYPE_CANCEL,
|
||||
_remoteObject);
|
||||
_collector.add(cancelledMessageObject, monitor);
|
||||
_connectorServicePool.remove(connectorService);
|
||||
throw new InterruptedException();
|
||||
}
|
||||
try
|
||||
{
|
||||
connectorService.connect(monitor);
|
||||
if (_exc != null)
|
||||
{
|
||||
|
@ -310,13 +309,11 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
|
|||
catch (InvocationTargetException exc)
|
||||
{
|
||||
showOperationErrorMessage(null, exc, ss);
|
||||
_connectorServicePool.remove(connectorService);
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
showOperationErrorMessage(null, e, ss);
|
||||
_connectorServicePool.remove(connectorService);
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
|
@ -470,7 +467,9 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
|
|||
{
|
||||
String excMsg = exc.getMessage();
|
||||
if ((excMsg == null) || (excMsg.length()==0))
|
||||
excMsg = "Exception " + exc.getClass().getName(); //$NON-NLS-1$
|
||||
exc.getClass().getName();
|
||||
else
|
||||
excMsg = exc.getClass().getName() + ": " + excMsg; //$NON-NLS-1$
|
||||
sysMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED);
|
||||
sysMsg.makeSubstitution(excMsg);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue