Added finally

deliverable_6
asdfasdf 6 years ago
parent 1b378485f2
commit 5e722ceba6

@ -27,7 +27,7 @@ public class Main {
//this.Iface = IfaceFactory.getIface(allOptions.getSection("ui")); //this.Iface = IfaceFactory.getIface(allOptions.getSection("ui"));
iface = IfaceFactory.getIface(this); iface = IfaceFactory.getIface(this);
} }
//Constructor for testing //Constructor for testing
public Main(boolean debug) { public Main(boolean debug) {
//init options, it will load defaults //init options, it will load defaults
@ -61,10 +61,15 @@ public class Main {
public void delWatchStock(String target) { public void delWatchStock(String target) {
//XXX Concurrency not ready //XXX Concurrency not ready
// Should add runnable to executor // Should add runnable to executor
boolean success = true;
try { try {
mainList.delStock(target); mainList.delStock(target);
success = true;
} catch (StockNotExistsException e) { } catch (StockNotExistsException e) {
System.out.println("Stock: " + target + " doesn't exists"); System.out.println("Stock: " + target + " doesn't exists");
success = false;
} finally {
System.out.println(success ? "Deleted: " + target : "Failed to delete: " + target);
} }
} }

Loading…
Cancel
Save