VirtualBox: Removed private propagate-methods and use Google directly instead. Minor code cleanup.

This commit is contained in:
Mattias Holmqvist 2012-01-10 07:31:22 +01:00
parent 2dfdbb4b56
commit 82e44d952b
3 changed files with 7 additions and 16 deletions

View File

@ -55,7 +55,7 @@ public class AttachNATAdapterToMachineIfNotAlreadyExists implements Function<IMa
networkAdapter.getNatDriver().addRedirect(ruleName, rule.getProtocol(), rule.getHost(), rule.getHostPort(),
rule.getGuest(), rule.getGuestPort());
} catch (VBoxException e) {
if (e.getMessage().indexOf("already exists") == -1)
if (!e.getMessage().contains("already exists"))
throw e;
}
}

View File

@ -83,7 +83,8 @@ public class RetrieveActiveBridgedInterfaces implements Function<NodeMetadata, L
}
} catch (SocketException e) {
logger.error(e, "Problem in listing network interfaces.");
propagate(e);
Throwables.propagate(e);
assert false;
}
return activeNetworkInterfaceNames;
}
@ -109,12 +110,6 @@ public class RetrieveActiveBridgedInterfaces implements Function<NodeMetadata, L
return bridgedInterfaceNames;
}
protected <T> T propagate(Exception e) {
Throwables.propagate(e);
assert false;
return null;
}
private class IsActiveBridgedInterface implements Predicate<String> {
private NetworkInterface networkInterface;
@ -130,7 +125,8 @@ public class RetrieveActiveBridgedInterfaces implements Function<NodeMetadata, L
.isLoopback());
} catch (SocketException e) {
logger.error(e, "Problem in listing network interfaces.");
propagate(e);
Throwables.propagate(e);
assert false;
}
return false;
}

View File

@ -68,18 +68,13 @@ public class TakeSnapshotIfNotAlreadyAttached implements Function<IMachine, ISna
logger.debug("Snapshot %s (description: %s) taken from %s", snapshotName, snapshotDesc, machine.getName());
} catch (Exception e) {
logger.error(e, "Problem creating snapshot %s (descripton: %s) from machine %s", snapshotName, snapshotDesc, machine.getName());
propogate(e);
Throwables.propagate(e);
assert false;
} finally {
session.unlockMachine();
}
}
return machine.getCurrentSnapshot();
}
protected <T> T propogate(Exception e) {
Throwables.propagate(e);
assert false;
return null;
}
}