Target[] tlist = new Target[targetNames.size()];
Target[] all = mgr.getTargets();
Set found = new HashSet();
for (int i = 0; i < tlist.length; i++) {
for (int j = 0; j < all.length; j++) {
Target server = all[j];
// check for exact target name match
if(server.getName().equals(targetNames.get(i))
// check for "target-nickname" match (they match if
// the full target name contains the user-provided
// nickname)
|| server.getName().indexOf(targetNames.get(i).toString()) > -1) {
tlist[i] = server;
if(found.contains(server.getName())) {
throw new DeploymentException("Target list should not contain duplicates or nicknames that match duplicates ("+targetNames.get(i)+")");
}
found.add(server.getName());
break;
}
}
if(tlist[i] == null) {
throw new DeploymentException("No target named or matching '"+targetNames.get(i)+"' was found");