Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 294502 | Differences between
and this patch

Collapse All | Expand All

(-)src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java (-3 / +39 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
3
 * Portions Copyright  2000-2007 The Apache Software Foundation
3
 * Portions Copyright  2000-2007 The Apache Software Foundation
4
 * All rights reserved. This program and the accompanying materials are made 
4
 * All rights reserved. This program and the accompanying materials are made 
5
 * available under the terms of the Apache Software License v2.0 which 
5
 * available under the terms of the Apache Software License v2.0 which 
Lines 25-34 Link Here
25
import java.util.Arrays;
25
import java.util.Arrays;
26
import java.util.Enumeration;
26
import java.util.Enumeration;
27
import java.util.HashMap;
27
import java.util.HashMap;
28
import java.util.HashSet;
28
import java.util.Iterator;
29
import java.util.Iterator;
29
import java.util.List;
30
import java.util.List;
31
import java.util.ListIterator;
30
import java.util.Map;
32
import java.util.Map;
31
import java.util.Properties;
33
import java.util.Properties;
34
import java.util.Set;
32
import java.util.Vector;
35
import java.util.Vector;
33
36
34
import org.apache.tools.ant.AntTypeDefinition;
37
import org.apache.tools.ant.AntTypeDefinition;
Lines 1068-1074 Link Here
1068
		if (!commands.isEmpty()) {
1071
		if (!commands.isEmpty()) {
1069
			processUnrecognizedCommands(commands);
1072
			processUnrecognizedCommands(commands);
1070
		}
1073
		}
1071
1074
		
1075
		if (!commands.isEmpty()) {
1076
			processUnrecognizedTargets(commands);
1077
		}
1078
		
1072
		if (!commands.isEmpty()) {
1079
		if (!commands.isEmpty()) {
1073
			processTargets(commands);
1080
			processTargets(commands);
1074
		}
1081
		}
Lines 1076-1081 Link Here
1076
		return true;
1083
		return true;
1077
	}
1084
	}
1078
	
1085
	
1086
	/**
1087
	 * Checks for unrecognized targets on the command line and
1088
	 * removes them.
1089
	 */
1090
	private void processUnrecognizedTargets(List commands) {
1091
		List list = getTargets();
1092
		Set names = new HashSet();
1093
		Iterator it = list.iterator();
1094
		while (it.hasNext()) {
1095
			Object element = it.next();
1096
			if (element instanceof List) {
1097
				List target = (List)element;
1098
				if (!target.isEmpty()) {
1099
					names.add(target.get(0));
1100
				}
1101
			}
1102
		}
1103
		ListIterator iterator = commands.listIterator();
1104
		
1105
		while (iterator.hasNext()) {
1106
			String target = (String) iterator.next();
1107
			if (!names.contains(target)) {
1108
				iterator.remove();
1109
				String message = MessageFormat.format("Unknown target: {0}", new Object[]{target});
1110
				logMessage(currentProject, message, Project.MSG_WARN); 
1111
			}
1112
		}
1113
	}
1114
	
1079
	/*
1115
	/*
1080
	 * Checks for unrecognized arguments on the command line.
1116
	 * Checks for unrecognized arguments on the command line.
1081
	 * Since there is no syntactic way to distingush between
1117
	 * Since there is no syntactic way to distingush between
Lines 1091-1097 Link Here
1091
1127
1092
		// find the last arg that begins with '-'
1128
		// find the last arg that begins with '-'
1093
		for (int i = commands.size() - 1; i >= 0; i--) {
1129
		for (int i = commands.size() - 1; i >= 0; i--) {
1094
			if (((String) commands.get(0)).startsWith("-")) { //$NON-NLS-1$
1130
			if (((String) commands.get(i)).startsWith("-")) { //$NON-NLS-1$
1095
				p = i;
1131
				p = i;
1096
				break;
1132
				break;
1097
			}
1133
			}

Return to bug 294502