Source:
<code>public RemoveNetworksModel(ListModel sourceListModel) { this.sourceListModel = sourceListModel; setTitle(ConstantsManager.getInstance().getConstants().removeLogicalNetworkTitle()); setHashName("remove_logical_network"); ArrayList<String> list = new ArrayList<String>(); boolean hasNetworkWithProvider = false; for (Network network : (Iterable<Network>) sourceListModel.getSelectedItems()) { if (network instanceof NetworkView) { NetworkView netView = (NetworkView) network; if (netView.getDescription() == null || netView.getDescription().trim().equals("")) { list.add(ConstantsManager.getInstance() .getMessages() .networkDc(netView.getName(), netView.getDataCenterName())); } else { list.add(ConstantsManager.getInstance() .getMessages() .networkDcDescription(netView.getName(), netView.getDataCenterName(), netView.getDescription())); } } else { if (network.getDescription() == null || "".equals(network.getDescription().trim())) { list.add(network.getName()); } else { list.add(StringFormat.format("%1$s (%2$s)", network.getName(), network.getDescription())); } } <START> if (network.isExternal()) { <END> getForce().setIsAvailable(true); getForce().setEntity(true); setForceLabel(ConstantsManager.getInstance().getConstants().removeNetworkFromProvider()); } } setItems(list); UICommand tempVar = new UICommand("onRemove", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); tempVar.setIsDefault(true); getCommands().add(tempVar); UICommand tempVar2 = new UICommand("cancel", this); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); tempVar2.setIsCancel(true); getCommands().add(tempVar2); }</code><technical_language>weird this potentially happen multiple times. harm in it, happen once, if of networks is external. move loop update a boolean here, stating external network encountered</technical_language>

Target:
public RemoveNetworksModel(ListModel sourceListModel) { this.sourceListModel = sourceListModel; setTitle(ConstantsManager.getInstance().getConstants().removeLogicalNetworkTitle()); setHashName("remove_logical_network"); ArrayList<String> list = new ArrayList<String>(); boolean externalNetworksWillBeRemoved = false; for (Network network : (Iterable<Network>) sourceListModel.getSelectedItems()) { if (network instanceof NetworkView) { NetworkView netView = (NetworkView) network; if (netView.getDescription() == null || netView.getDescription().trim().equals("")) { list.add(ConstantsManager.getInstance() .getMessages() .networkDc(netView.getName(), netView.getDataCenterName())); } else { list.add(ConstantsManager.getInstance() .getMessages() .networkDcDescription(netView.getName(), netView.getDataCenterName(), netView.getDescription())); } } else { if (network.getDescription() == null || "".equals(network.getDescription().trim())) { list.add(network.getName()); } else { list.add(StringFormat.format("%1$s (%2$s)", network.getName(), network.getDescription())); } } if (network.isExternal() && !externalNetworksWillBeRemoved) { externalNetworksWillBeRemoved = true; } } setItems(list); if (externalNetworksWillBeRemoved) { getForce().setIsAvailable(true); getForce().setEntity(true); setForceLabel(ConstantsManager.getInstance().getConstants().removeNetworkFromProvider()); } UICommand tempVar = new UICommand("onRemove", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); tempVar.setIsDefault(true); getCommands().add(tempVar); UICommand tempVar2 = new UICommand("cancel", this); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); tempVar2.setIsCancel(true); getCommands().add(tempVar2); }