View | Details | Raw Unified | Return to bug 255974
Collapse All | Expand All

(-)src/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java (-5 / +2 lines)
Lines 31-37 Link Here
31
import org.eclipse.jdt.core.compiler.CategorizedProblem;
31
import org.eclipse.jdt.core.compiler.CategorizedProblem;
32
import org.eclipse.jdt.core.compiler.CharOperation;
32
import org.eclipse.jdt.core.compiler.CharOperation;
33
import org.eclipse.jdt.core.compiler.CompilationProgress;
33
import org.eclipse.jdt.core.compiler.CompilationProgress;
34
import org.eclipse.jdt.core.compiler.InvalidInputException;
35
import org.eclipse.jdt.internal.compiler.ClassFile;
34
import org.eclipse.jdt.internal.compiler.ClassFile;
36
import org.eclipse.jdt.internal.compiler.CompilationResult;
35
import org.eclipse.jdt.internal.compiler.CompilationResult;
37
import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
36
import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
Lines 69-83 Link Here
69
				// request compilation
68
				// request compilation
70
				performCompilation();
69
				performCompilation();
71
			}
70
			}
72
		} catch (InvalidInputException e) {
71
		} catch(IllegalArgumentException e) {
73
			this.logger.logException(e);
72
			this.logger.logException(e);
74
			if (this.systemExitWhenFinished) {
73
			if (this.systemExitWhenFinished) {
75
				cleanup();
74
				cleanup();
76
				System.exit(-1);
75
				System.exit(-1);
77
			}
76
			}
78
			return false;
77
			return false;
79
		} catch(IllegalArgumentException e) {
80
			throw e;
81
		} catch (RuntimeException e) { // internal compiler failure
78
		} catch (RuntimeException e) { // internal compiler failure
82
			this.logger.logException(e);
79
			this.logger.logException(e);
83
			return false;
80
			return false;
Lines 319-325 Link Here
319
			ArrayList classpaths,
316
			ArrayList classpaths,
320
			ArrayList extdirsClasspaths,
317
			ArrayList extdirsClasspaths,
321
			ArrayList endorsedDirClasspaths,
318
			ArrayList endorsedDirClasspaths,
322
			String customEncoding) throws InvalidInputException {
319
			String customEncoding) {
323
320
324
		ArrayList<FileSystem.Classpath> fileSystemClasspaths = new ArrayList<FileSystem.Classpath>();
321
		ArrayList<FileSystem.Classpath> fileSystemClasspaths = new ArrayList<FileSystem.Classpath>();
325
		EclipseFileManager javaFileManager = null;
322
		EclipseFileManager javaFileManager = null;
(-)src/org/eclipse/jdt/internal/compiler/tool/EclipseCompiler.java (-3 / +2 lines)
Lines 35-41 Link Here
35
import javax.tools.StandardJavaFileManager;
35
import javax.tools.StandardJavaFileManager;
36
import javax.tools.StandardLocation;
36
import javax.tools.StandardLocation;
37
37
38
import org.eclipse.jdt.core.compiler.InvalidInputException;
39
import org.eclipse.jdt.internal.compiler.batch.Main;
38
import org.eclipse.jdt.internal.compiler.batch.Main;
40
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
39
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
41
40
Lines 167-174 Link Here
167
		allOptions.toArray(optionsToProcess);
166
		allOptions.toArray(optionsToProcess);
168
		try {
167
		try {
169
			eclipseCompiler2.configure(optionsToProcess);
168
			eclipseCompiler2.configure(optionsToProcess);
170
		} catch (InvalidInputException e) {
169
		} catch (IllegalArgumentException e) {
171
			throw new RuntimeException(e);
170
			throw e;
172
		}
171
		}
173
172
174
		if (eclipseCompiler2.fileManager instanceof StandardJavaFileManager) {
173
		if (eclipseCompiler2.fileManager instanceof StandardJavaFileManager) {
(-)src/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java (-11 / +10 lines)
Lines 38-44 Link Here
38
import javax.tools.JavaFileObject.Kind;
38
import javax.tools.JavaFileObject.Kind;
39
39
40
import org.eclipse.jdt.core.compiler.IProblem;
40
import org.eclipse.jdt.core.compiler.IProblem;
41
import org.eclipse.jdt.core.compiler.InvalidInputException;
42
import org.eclipse.jdt.internal.compiler.batch.FileSystem;
41
import org.eclipse.jdt.internal.compiler.batch.FileSystem;
43
import org.eclipse.jdt.internal.compiler.batch.Main;
42
import org.eclipse.jdt.internal.compiler.batch.Main;
44
import org.eclipse.jdt.internal.compiler.batch.Main.ResourceBundleFactory;
43
import org.eclipse.jdt.internal.compiler.batch.Main.ResourceBundleFactory;
Lines 276-282 Link Here
276
		ArrayList<File> files = new ArrayList<File>();
275
		ArrayList<File> files = new ArrayList<File>();
277
		try {
276
		try {
278
			this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false);
277
			this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false);
279
		} catch (InvalidInputException e) {
278
		} catch (IllegalArgumentException e) {
280
			return null;
279
			return null;
281
		}
280
		}
282
		for (FileSystem.Classpath classpath : paths) {
281
		for (FileSystem.Classpath classpath : paths) {
Lines 346-352 Link Here
346
		ArrayList<File> files = new ArrayList<File>();
345
		ArrayList<File> files = new ArrayList<File>();
347
		try {
346
		try {
348
			this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false);
347
			this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false);
349
		} catch (InvalidInputException e) {
348
		} catch (IllegalArgumentException e) {
350
			return null;
349
			return null;
351
		}
350
		}
352
		for (FileSystem.Classpath classpath : paths) {
351
		for (FileSystem.Classpath classpath : paths) {
Lines 360-366 Link Here
360
		ArrayList<File> files = new ArrayList<File>();
359
		ArrayList<File> files = new ArrayList<File>();
361
		try {
360
		try {
362
			this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false);
361
			this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false);
363
		} catch (InvalidInputException e) {
362
		} catch (IllegalArgumentException e) {
364
			return null;
363
			return null;
365
		}
364
		}
366
		for (FileSystem.Classpath classpath : paths) {
365
		for (FileSystem.Classpath classpath : paths) {
Lines 854-861 Link Here
854
	@SuppressWarnings("unchecked")
853
	@SuppressWarnings("unchecked")
855
	public void processPathEntries(final int defaultSize, final ArrayList paths,
854
	public void processPathEntries(final int defaultSize, final ArrayList paths,
856
			final String currentPath, String customEncoding, boolean isSourceOnly,
855
			final String currentPath, String customEncoding, boolean isSourceOnly,
857
			boolean rejectDestinationPathOnJars)
856
			boolean rejectDestinationPathOnJars) {
858
		throws InvalidInputException {
857
859
		String currentClasspathName = null;
858
		String currentClasspathName = null;
860
		String currentDestinationPath = null;
859
		String currentDestinationPath = null;
861
		ArrayList currentRuleSpecs = new ArrayList(defaultSize);
860
		ArrayList currentRuleSpecs = new ArrayList(defaultSize);
Lines 915-921 Link Here
915
					state = rulesNeedAnotherRule;
914
					state = rulesNeedAnotherRule;
916
					break;
915
					break;
917
				case destinationPathReadyToClose:
916
				case destinationPathReadyToClose:
918
					throw new InvalidInputException(
917
					throw new IllegalArgumentException(
919
							this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$
918
							this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$
920
									currentPath));
919
									currentPath));
921
				case bracketClosed:
920
				case bracketClosed:
Lines 970-976 Link Here
970
				case rulesStart:
969
				case rulesStart:
971
					if (token.startsWith("-d ")) { //$NON-NLS-1$
970
					if (token.startsWith("-d ")) { //$NON-NLS-1$
972
						if (currentDestinationPath != null) {
971
						if (currentDestinationPath != null) {
973
							throw new InvalidInputException(
972
							throw new IllegalArgumentException(
974
									this.bind("configure.duplicateDestinationPathEntry", //$NON-NLS-1$
973
									this.bind("configure.duplicateDestinationPathEntry", //$NON-NLS-1$
975
											currentPath));
974
											currentPath));
976
						}
975
						}
Lines 980-986 Link Here
980
					} // else we proceed with a rule
979
					} // else we proceed with a rule
981
				case rulesNeedAnotherRule:
980
				case rulesNeedAnotherRule:
982
					if (currentDestinationPath != null) {
981
					if (currentDestinationPath != null) {
983
						throw new InvalidInputException(
982
						throw new IllegalArgumentException(
984
								this.bind("configure.accessRuleAfterDestinationPath", //$NON-NLS-1$
983
								this.bind("configure.accessRuleAfterDestinationPath", //$NON-NLS-1$
985
									currentPath));
984
									currentPath));
986
					}
985
					}
Lines 1032-1038 Link Here
1032
	protected void addNewEntry(ArrayList paths, String currentClasspathName,
1031
	protected void addNewEntry(ArrayList paths, String currentClasspathName,
1033
			ArrayList currentRuleSpecs, String customEncoding,
1032
			ArrayList currentRuleSpecs, String customEncoding,
1034
			String destPath, boolean isSourceOnly,
1033
			String destPath, boolean isSourceOnly,
1035
			boolean rejectDestinationPathOnJars) throws InvalidInputException {
1034
			boolean rejectDestinationPathOnJars) {
1036
1035
1037
		int rulesSpecsSize = currentRuleSpecs.size();
1036
		int rulesSpecsSize = currentRuleSpecs.size();
1038
		AccessRuleSet accessRuleSet = null;
1037
		AccessRuleSet accessRuleSet = null;
Lines 1085-1091 Link Here
1085
		if (rejectDestinationPathOnJars && destPath != null &&
1084
		if (rejectDestinationPathOnJars && destPath != null &&
1086
				(currentClasspathName.endsWith(".jar") || //$NON-NLS-1$
1085
				(currentClasspathName.endsWith(".jar") || //$NON-NLS-1$
1087
					currentClasspathName.endsWith(".zip"))) { //$NON-NLS-1$
1086
					currentClasspathName.endsWith(".zip"))) { //$NON-NLS-1$
1088
			throw new InvalidInputException(
1087
			throw new IllegalArgumentException(
1089
					this.bind("configure.unexpectedDestinationPathEntryFile", //$NON-NLS-1$
1088
					this.bind("configure.unexpectedDestinationPathEntryFile", //$NON-NLS-1$
1090
								currentClasspathName));
1089
								currentClasspathName));
1091
			}
1090
			}
(-)src/org/eclipse/jdt/internal/compiler/apt/util/EclipseFileManager.java (-11 / +9 lines)
Lines 38-44 Link Here
38
import javax.tools.JavaFileObject.Kind;
38
import javax.tools.JavaFileObject.Kind;
39
39
40
import org.eclipse.jdt.core.compiler.IProblem;
40
import org.eclipse.jdt.core.compiler.IProblem;
41
import org.eclipse.jdt.core.compiler.InvalidInputException;
42
import org.eclipse.jdt.internal.compiler.batch.FileSystem;
41
import org.eclipse.jdt.internal.compiler.batch.FileSystem;
43
import org.eclipse.jdt.internal.compiler.batch.Main;
42
import org.eclipse.jdt.internal.compiler.batch.Main;
44
import org.eclipse.jdt.internal.compiler.batch.Main.ResourceBundleFactory;
43
import org.eclipse.jdt.internal.compiler.batch.Main.ResourceBundleFactory;
Lines 276-282 Link Here
276
		ArrayList<File> files = new ArrayList<File>();
275
		ArrayList<File> files = new ArrayList<File>();
277
		try {
276
		try {
278
			this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false);
277
			this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false);
279
		} catch (InvalidInputException e) {
278
		} catch (IllegalArgumentException e) {
280
			return null;
279
			return null;
281
		}
280
		}
282
		for (FileSystem.Classpath classpath : paths) {
281
		for (FileSystem.Classpath classpath : paths) {
Lines 346-352 Link Here
346
		ArrayList<File> files = new ArrayList<File>();
345
		ArrayList<File> files = new ArrayList<File>();
347
		try {
346
		try {
348
			this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false);
347
			this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false);
349
		} catch (InvalidInputException e) {
348
		} catch (IllegalArgumentException e) {
350
			return null;
349
			return null;
351
		}
350
		}
352
		for (FileSystem.Classpath classpath : paths) {
351
		for (FileSystem.Classpath classpath : paths) {
Lines 360-366 Link Here
360
		ArrayList<File> files = new ArrayList<File>();
359
		ArrayList<File> files = new ArrayList<File>();
361
		try {
360
		try {
362
			this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false);
361
			this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false);
363
		} catch (InvalidInputException e) {
362
		} catch (IllegalArgumentException e) {
364
			return null;
363
			return null;
365
		}
364
		}
366
		for (FileSystem.Classpath classpath : paths) {
365
		for (FileSystem.Classpath classpath : paths) {
Lines 872-879 Link Here
872
	@SuppressWarnings("unchecked")
871
	@SuppressWarnings("unchecked")
873
	public void processPathEntries(final int defaultSize, final ArrayList paths,
872
	public void processPathEntries(final int defaultSize, final ArrayList paths,
874
			final String currentPath, String customEncoding, boolean isSourceOnly,
873
			final String currentPath, String customEncoding, boolean isSourceOnly,
875
			boolean rejectDestinationPathOnJars)
874
			boolean rejectDestinationPathOnJars) {
876
		throws InvalidInputException {
877
		String currentClasspathName = null;
875
		String currentClasspathName = null;
878
		String currentDestinationPath = null;
876
		String currentDestinationPath = null;
879
		ArrayList currentRuleSpecs = new ArrayList(defaultSize);
877
		ArrayList currentRuleSpecs = new ArrayList(defaultSize);
Lines 933-939 Link Here
933
					state = rulesNeedAnotherRule;
931
					state = rulesNeedAnotherRule;
934
					break;
932
					break;
935
				case destinationPathReadyToClose:
933
				case destinationPathReadyToClose:
936
					throw new InvalidInputException(
934
					throw new IllegalArgumentException(
937
							this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$
935
							this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$
938
									currentPath));
936
									currentPath));
939
				case bracketClosed:
937
				case bracketClosed:
Lines 988-994 Link Here
988
				case rulesStart:
986
				case rulesStart:
989
					if (token.startsWith("-d ")) { //$NON-NLS-1$
987
					if (token.startsWith("-d ")) { //$NON-NLS-1$
990
						if (currentDestinationPath != null) {
988
						if (currentDestinationPath != null) {
991
							throw new InvalidInputException(
989
							throw new IllegalArgumentException(
992
									this.bind("configure.duplicateDestinationPathEntry", //$NON-NLS-1$
990
									this.bind("configure.duplicateDestinationPathEntry", //$NON-NLS-1$
993
											currentPath));
991
											currentPath));
994
						}
992
						}
Lines 998-1004 Link Here
998
					} // else we proceed with a rule
996
					} // else we proceed with a rule
999
				case rulesNeedAnotherRule:
997
				case rulesNeedAnotherRule:
1000
					if (currentDestinationPath != null) {
998
					if (currentDestinationPath != null) {
1001
						throw new InvalidInputException(
999
						throw new IllegalArgumentException(
1002
								this.bind("configure.accessRuleAfterDestinationPath", //$NON-NLS-1$
1000
								this.bind("configure.accessRuleAfterDestinationPath", //$NON-NLS-1$
1003
									currentPath));
1001
									currentPath));
1004
					}
1002
					}
Lines 1050-1056 Link Here
1050
	protected void addNewEntry(ArrayList paths, String currentClasspathName,
1048
	protected void addNewEntry(ArrayList paths, String currentClasspathName,
1051
			ArrayList currentRuleSpecs, String customEncoding,
1049
			ArrayList currentRuleSpecs, String customEncoding,
1052
			String destPath, boolean isSourceOnly,
1050
			String destPath, boolean isSourceOnly,
1053
			boolean rejectDestinationPathOnJars) throws InvalidInputException {
1051
			boolean rejectDestinationPathOnJars) {
1054
1052
1055
		int rulesSpecsSize = currentRuleSpecs.size();
1053
		int rulesSpecsSize = currentRuleSpecs.size();
1056
		AccessRuleSet accessRuleSet = null;
1054
		AccessRuleSet accessRuleSet = null;
Lines 1103-1109 Link Here
1103
		if (rejectDestinationPathOnJars && destPath != null &&
1101
		if (rejectDestinationPathOnJars && destPath != null &&
1104
				(currentClasspathName.endsWith(".jar") || //$NON-NLS-1$
1102
				(currentClasspathName.endsWith(".jar") || //$NON-NLS-1$
1105
					currentClasspathName.endsWith(".zip"))) { //$NON-NLS-1$
1103
					currentClasspathName.endsWith(".zip"))) { //$NON-NLS-1$
1106
			throw new InvalidInputException(
1104
			throw new IllegalArgumentException(
1107
					this.bind("configure.unexpectedDestinationPathEntryFile", //$NON-NLS-1$
1105
					this.bind("configure.unexpectedDestinationPathEntryFile", //$NON-NLS-1$
1108
								currentClasspathName));
1106
								currentClasspathName));
1109
			}
1107
			}
(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-83 / +80 lines)
Lines 47-53 Link Here
47
import org.eclipse.jdt.core.compiler.CharOperation;
47
import org.eclipse.jdt.core.compiler.CharOperation;
48
import org.eclipse.jdt.core.compiler.CompilationProgress;
48
import org.eclipse.jdt.core.compiler.CompilationProgress;
49
import org.eclipse.jdt.core.compiler.IProblem;
49
import org.eclipse.jdt.core.compiler.IProblem;
50
import org.eclipse.jdt.core.compiler.InvalidInputException;
51
import org.eclipse.jdt.core.compiler.batch.BatchCompiler;
50
import org.eclipse.jdt.core.compiler.batch.BatchCompiler;
52
import org.eclipse.jdt.internal.compiler.AbstractAnnotationProcessorManager;
51
import org.eclipse.jdt.internal.compiler.AbstractAnnotationProcessorManager;
53
import org.eclipse.jdt.internal.compiler.ClassFile;
52
import org.eclipse.jdt.internal.compiler.ClassFile;
Lines 1138-1144 Link Here
1138
		public void setEmacs() {
1137
		public void setEmacs() {
1139
			this.tagBits |= Logger.EMACS;
1138
			this.tagBits |= Logger.EMACS;
1140
		}
1139
		}
1141
		public void setLog(String logFileName) throws InvalidInputException {
1140
		public void setLog(String logFileName) {
1142
			final Date date = new Date();
1141
			final Date date = new Date();
1143
			final DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG, Locale.getDefault());
1142
			final DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG, Locale.getDefault());
1144
			try {
1143
			try {
Lines 1167-1175 Link Here
1167
					this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$
1166
					this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$
1168
				}
1167
				}
1169
			} catch (FileNotFoundException e) {
1168
			} catch (FileNotFoundException e) {
1170
				throw new InvalidInputException(this.main.bind("configure.cannotOpenLog", logFileName)); //$NON-NLS-1$
1169
				throw new IllegalArgumentException(this.main.bind("configure.cannotOpenLog", logFileName)); //$NON-NLS-1$
1171
			} catch (UnsupportedEncodingException e) {
1170
			} catch (UnsupportedEncodingException e) {
1172
				throw new InvalidInputException(this.main.bind("configure.cannotOpenLogInvalidEncoding", logFileName)); //$NON-NLS-1$
1171
				throw new IllegalArgumentException(this.main.bind("configure.cannotOpenLogInvalidEncoding", logFileName)); //$NON-NLS-1$
1173
			}
1172
			}
1174
		}
1173
		}
1175
		private void startLoggingExtraProblems(int count) {
1174
		private void startLoggingExtraProblems(int count) {
Lines 1450-1456 Link Here
1450
protected void addNewEntry(ArrayList paths, String currentClasspathName,
1449
protected void addNewEntry(ArrayList paths, String currentClasspathName,
1451
		ArrayList currentRuleSpecs, String customEncoding,
1450
		ArrayList currentRuleSpecs, String customEncoding,
1452
		String destPath, boolean isSourceOnly,
1451
		String destPath, boolean isSourceOnly,
1453
		boolean rejectDestinationPathOnJars) throws InvalidInputException {
1452
		boolean rejectDestinationPathOnJars) {
1454
1453
1455
	int rulesSpecsSize = currentRuleSpecs.size();
1454
	int rulesSpecsSize = currentRuleSpecs.size();
1456
	AccessRuleSet accessRuleSet = null;
1455
	AccessRuleSet accessRuleSet = null;
Lines 1506-1512 Link Here
1506
	}
1505
	}
1507
	if (rejectDestinationPathOnJars && destPath != null &&
1506
	if (rejectDestinationPathOnJars && destPath != null &&
1508
			Util.isPotentialZipArchive(currentClasspathName)) {
1507
			Util.isPotentialZipArchive(currentClasspathName)) {
1509
		throw new InvalidInputException(
1508
		throw new IllegalArgumentException(
1510
			this.bind("configure.unexpectedDestinationPathEntryFile", //$NON-NLS-1$
1509
			this.bind("configure.unexpectedDestinationPathEntryFile", //$NON-NLS-1$
1511
						currentClasspathName));
1510
						currentClasspathName));
1512
	}
1511
	}
Lines 1662-1668 Link Here
1662
			this.logger.close();
1661
			this.logger.close();
1663
			System.exit(this.globalErrorsCount > 0 ? -1 : 0);
1662
			System.exit(this.globalErrorsCount > 0 ? -1 : 0);
1664
		}
1663
		}
1665
	} catch (InvalidInputException e) {
1664
	} catch (IllegalArgumentException e) {
1666
		this.logger.logException(e);
1665
		this.logger.logException(e);
1667
		if (this.systemExitWhenFinished) {
1666
		if (this.systemExitWhenFinished) {
1668
			this.logger.flush();
1667
			this.logger.flush();
Lines 1692-1698 Link Here
1692
/*
1691
/*
1693
Decode the command line arguments
1692
Decode the command line arguments
1694
 */
1693
 */
1695
public void configure(String[] argv) throws InvalidInputException {
1694
public void configure(String[] argv) {
1696
1695
1697
	if ((argv == null) || (argv.length == 0)) {
1696
	if ((argv == null) || (argv.length == 0)) {
1698
		printUsage();
1697
		printUsage();
Lines 1774-1780 Link Here
1774
					}
1773
					}
1775
					newArgs = tokenize(buffer.toString());
1774
					newArgs = tokenize(buffer.toString());
1776
				} catch(IOException e) {
1775
				} catch(IOException e) {
1777
					throw new InvalidInputException(
1776
					throw new IllegalArgumentException(
1778
						this.bind("configure.invalidexpansionargumentname", arg)); //$NON-NLS-1$
1777
						this.bind("configure.invalidexpansionargumentname", arg)); //$NON-NLS-1$
1779
				}
1778
				}
1780
			}
1779
			}
Lines 1800-1806 Link Here
1800
	while (++index < argCount) {
1799
	while (++index < argCount) {
1801
1800
1802
		if (customEncoding != null) {
1801
		if (customEncoding != null) {
1803
			throw new InvalidInputException(
1802
			throw new IllegalArgumentException(
1804
				this.bind("configure.unexpectedCustomEncoding", currentArg, customEncoding)); //$NON-NLS-1$
1803
				this.bind("configure.unexpectedCustomEncoding", currentArg, customEncoding)); //$NON-NLS-1$
1805
		}
1804
		}
1806
1805
Lines 1809-1815 Link Here
1809
		switch(mode) {
1808
		switch(mode) {
1810
			case DEFAULT :
1809
			case DEFAULT :
1811
				if (currentArg.startsWith("[")) { //$NON-NLS-1$
1810
				if (currentArg.startsWith("[")) { //$NON-NLS-1$
1812
					throw new InvalidInputException(
1811
					throw new IllegalArgumentException(
1813
						this.bind("configure.unexpectedBracket", //$NON-NLS-1$
1812
						this.bind("configure.unexpectedBracket", //$NON-NLS-1$
1814
									currentArg));
1813
									currentArg));
1815
				}
1814
				}
Lines 1818-1824 Link Here
1818
					// look for encoding specification
1817
					// look for encoding specification
1819
					int encodingStart = currentArg.indexOf('[') + 1;
1818
					int encodingStart = currentArg.indexOf('[') + 1;
1820
					if (encodingStart <= 1) {
1819
					if (encodingStart <= 1) {
1821
						throw new InvalidInputException(
1820
						throw new IllegalArgumentException(
1822
								this.bind("configure.unexpectedBracket", currentArg)); //$NON-NLS-1$
1821
								this.bind("configure.unexpectedBracket", currentArg)); //$NON-NLS-1$
1823
					}
1822
					}
1824
					int encodingEnd = currentArg.length() - 1;
1823
					int encodingEnd = currentArg.length() - 1;
Lines 1828-1834 Link Here
1828
							try { // ensure encoding is supported
1827
							try { // ensure encoding is supported
1829
								new InputStreamReader(new ByteArrayInputStream(new byte[0]), customEncoding);
1828
								new InputStreamReader(new ByteArrayInputStream(new byte[0]), customEncoding);
1830
							} catch (UnsupportedEncodingException e) {
1829
							} catch (UnsupportedEncodingException e) {
1831
								throw new InvalidInputException(
1830
								throw new IllegalArgumentException(
1832
									this.bind("configure.unsupportedEncoding", customEncoding)); //$NON-NLS-1$
1831
									this.bind("configure.unsupportedEncoding", customEncoding)); //$NON-NLS-1$
1833
							}
1832
							}
1834
						}
1833
						}
Lines 1871-1891 Link Here
1871
				}
1870
				}
1872
				if (currentArg.equals("-log")) { //$NON-NLS-1$
1871
				if (currentArg.equals("-log")) { //$NON-NLS-1$
1873
					if (this.log != null)
1872
					if (this.log != null)
1874
						throw new InvalidInputException(
1873
						throw new IllegalArgumentException(
1875
							this.bind("configure.duplicateLog", currentArg)); //$NON-NLS-1$
1874
							this.bind("configure.duplicateLog", currentArg)); //$NON-NLS-1$
1876
					mode = INSIDE_LOG;
1875
					mode = INSIDE_LOG;
1877
					continue;
1876
					continue;
1878
				}
1877
				}
1879
				if (currentArg.equals("-repeat")) { //$NON-NLS-1$
1878
				if (currentArg.equals("-repeat")) { //$NON-NLS-1$
1880
					if (this.maxRepetition > 0)
1879
					if (this.maxRepetition > 0)
1881
						throw new InvalidInputException(
1880
						throw new IllegalArgumentException(
1882
							this.bind("configure.duplicateRepeat", currentArg)); //$NON-NLS-1$
1881
							this.bind("configure.duplicateRepeat", currentArg)); //$NON-NLS-1$
1883
					mode = INSIDE_REPETITION;
1882
					mode = INSIDE_REPETITION;
1884
					continue;
1883
					continue;
1885
				}
1884
				}
1886
				if (currentArg.equals("-maxProblems")) { //$NON-NLS-1$
1885
				if (currentArg.equals("-maxProblems")) { //$NON-NLS-1$
1887
					if (this.maxProblems > 0)
1886
					if (this.maxProblems > 0)
1888
						throw new InvalidInputException(
1887
						throw new IllegalArgumentException(
1889
							this.bind("configure.duplicateMaxProblems", currentArg)); //$NON-NLS-1$
1888
							this.bind("configure.duplicateMaxProblems", currentArg)); //$NON-NLS-1$
1890
					mode = INSIDE_MAX_PROBLEMS;
1889
					mode = INSIDE_MAX_PROBLEMS;
1891
					continue;
1890
					continue;
Lines 1900-1906 Link Here
1900
				}
1899
				}
1901
				if (currentArg.equals("-1.3")) { //$NON-NLS-1$
1900
				if (currentArg.equals("-1.3")) { //$NON-NLS-1$
1902
					if (didSpecifyCompliance) {
1901
					if (didSpecifyCompliance) {
1903
						throw new InvalidInputException(
1902
						throw new IllegalArgumentException(
1904
							this.bind("configure.duplicateCompliance", currentArg));//$NON-NLS-1$
1903
							this.bind("configure.duplicateCompliance", currentArg));//$NON-NLS-1$
1905
					}
1904
					}
1906
					didSpecifyCompliance = true;
1905
					didSpecifyCompliance = true;
Lines 1910-1916 Link Here
1910
				}
1909
				}
1911
				if (currentArg.equals("-1.4")) { //$NON-NLS-1$
1910
				if (currentArg.equals("-1.4")) { //$NON-NLS-1$
1912
					if (didSpecifyCompliance) {
1911
					if (didSpecifyCompliance) {
1913
						throw new InvalidInputException(
1912
						throw new IllegalArgumentException(
1914
							this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
1913
							this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
1915
					}
1914
					}
1916
					didSpecifyCompliance = true;
1915
					didSpecifyCompliance = true;
Lines 1920-1926 Link Here
1920
				}
1919
				}
1921
				if (currentArg.equals("-1.5") || currentArg.equals("-5") || currentArg.equals("-5.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1920
				if (currentArg.equals("-1.5") || currentArg.equals("-5") || currentArg.equals("-5.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1922
					if (didSpecifyCompliance) {
1921
					if (didSpecifyCompliance) {
1923
						throw new InvalidInputException(
1922
						throw new IllegalArgumentException(
1924
							this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
1923
							this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
1925
					}
1924
					}
1926
					didSpecifyCompliance = true;
1925
					didSpecifyCompliance = true;
Lines 1930-1936 Link Here
1930
				}
1929
				}
1931
				if (currentArg.equals("-1.6") || currentArg.equals("-6") || currentArg.equals("-6.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1930
				if (currentArg.equals("-1.6") || currentArg.equals("-6") || currentArg.equals("-6.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1932
					if (didSpecifyCompliance) {
1931
					if (didSpecifyCompliance) {
1933
						throw new InvalidInputException(
1932
						throw new IllegalArgumentException(
1934
							this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
1933
							this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
1935
					}
1934
					}
1936
					didSpecifyCompliance = true;
1935
					didSpecifyCompliance = true;
Lines 1940-1946 Link Here
1940
				}
1939
				}
1941
				if (currentArg.equals("-1.7") || currentArg.equals("-7") || currentArg.equals("-7.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1940
				if (currentArg.equals("-1.7") || currentArg.equals("-7") || currentArg.equals("-7.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1942
					if (didSpecifyCompliance) {
1941
					if (didSpecifyCompliance) {
1943
						throw new InvalidInputException(
1942
						throw new IllegalArgumentException(
1944
							this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
1943
							this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
1945
					}
1944
					}
1946
					didSpecifyCompliance = true;
1945
					didSpecifyCompliance = true;
Lines 1956-1962 Link Here
1956
							errorMessage.append(' ');
1955
							errorMessage.append(' ');
1957
							errorMessage.append(newCommandLineArgs[index + 1]);
1956
							errorMessage.append(newCommandLineArgs[index + 1]);
1958
						}
1957
						}
1959
						throw new InvalidInputException(
1958
						throw new IllegalArgumentException(
1960
							this.bind("configure.duplicateOutputPath", errorMessage.toString())); //$NON-NLS-1$
1959
							this.bind("configure.duplicateOutputPath", errorMessage.toString())); //$NON-NLS-1$
1961
					}
1960
					}
1962
					mode = INSIDE_DESTINATION_PATH;
1961
					mode = INSIDE_DESTINATION_PATH;
Lines 1975-1981 Link Here
1975
							errorMessage.append(' ');
1974
							errorMessage.append(' ');
1976
							errorMessage.append(newCommandLineArgs[index + 1]);
1975
							errorMessage.append(newCommandLineArgs[index + 1]);
1977
						}
1976
						}
1978
						throw new InvalidInputException(
1977
						throw new IllegalArgumentException(
1979
							this.bind("configure.duplicateBootClasspath", errorMessage.toString())); //$NON-NLS-1$
1978
							this.bind("configure.duplicateBootClasspath", errorMessage.toString())); //$NON-NLS-1$
1980
					}
1979
					}
1981
					mode = INSIDE_BOOTCLASSPATH_start;
1980
					mode = INSIDE_BOOTCLASSPATH_start;
Lines 1989-1995 Link Here
1989
							errorMessage.append(' ');
1988
							errorMessage.append(' ');
1990
							errorMessage.append(newCommandLineArgs[index + 1]);
1989
							errorMessage.append(newCommandLineArgs[index + 1]);
1991
						}
1990
						}
1992
						throw new InvalidInputException(
1991
						throw new IllegalArgumentException(
1993
							this.bind("configure.duplicateSourcepath", errorMessage.toString())); //$NON-NLS-1$
1992
							this.bind("configure.duplicateSourcepath", errorMessage.toString())); //$NON-NLS-1$
1994
					}
1993
					}
1995
					mode = INSIDE_SOURCE_PATH_start;
1994
					mode = INSIDE_SOURCE_PATH_start;
Lines 2003-2009 Link Here
2003
							errorMessage.append(' ');
2002
							errorMessage.append(' ');
2004
							errorMessage.append(newCommandLineArgs[index + 1]);
2003
							errorMessage.append(newCommandLineArgs[index + 1]);
2005
						}
2004
						}
2006
						throw new InvalidInputException(
2005
						throw new IllegalArgumentException(
2007
							this.bind("configure.duplicateExtDirs", errorMessage.toString())); //$NON-NLS-1$
2006
							this.bind("configure.duplicateExtDirs", errorMessage.toString())); //$NON-NLS-1$
2008
					}
2007
					}
2009
					mode = INSIDE_EXT_DIRS;
2008
					mode = INSIDE_EXT_DIRS;
Lines 2017-2023 Link Here
2017
							errorMessage.append(' ');
2016
							errorMessage.append(' ');
2018
							errorMessage.append(newCommandLineArgs[index + 1]);
2017
							errorMessage.append(newCommandLineArgs[index + 1]);
2019
						}
2018
						}
2020
						throw new InvalidInputException(
2019
						throw new IllegalArgumentException(
2021
							this.bind("configure.duplicateEndorsedDirs", errorMessage.toString())); //$NON-NLS-1$
2020
							this.bind("configure.duplicateEndorsedDirs", errorMessage.toString())); //$NON-NLS-1$
2022
					}
2021
					}
2023
					mode = INSIDE_ENDORSED_DIRS;
2022
					mode = INSIDE_ENDORSED_DIRS;
Lines 2138-2150 Link Here
2138
									CompilerOptions.OPTION_SourceFileAttribute,
2137
									CompilerOptions.OPTION_SourceFileAttribute,
2139
									CompilerOptions.GENERATE);
2138
									CompilerOptions.GENERATE);
2140
							} else {
2139
							} else {
2141
								throw new InvalidInputException(
2140
								throw new IllegalArgumentException(
2142
									this.bind("configure.invalidDebugOption", debugOption)); //$NON-NLS-1$
2141
									this.bind("configure.invalidDebugOption", debugOption)); //$NON-NLS-1$
2143
							}
2142
							}
2144
						}
2143
						}
2145
						continue;
2144
						continue;
2146
					}
2145
					}
2147
					throw new InvalidInputException(
2146
					throw new IllegalArgumentException(
2148
						this.bind("configure.invalidDebugOption", debugOption)); //$NON-NLS-1$
2147
						this.bind("configure.invalidDebugOption", debugOption)); //$NON-NLS-1$
2149
				}
2148
				}
2150
				if (currentArg.startsWith("-nowarn")) { //$NON-NLS-1$
2149
				if (currentArg.startsWith("-nowarn")) { //$NON-NLS-1$
Lines 2161-2167 Link Here
2161
						continue;
2160
						continue;
2162
					}
2161
					}
2163
					if (length <= 6) {
2162
					if (length <= 6) {
2164
						throw new InvalidInputException(
2163
						throw new IllegalArgumentException(
2165
							this.bind("configure.invalidWarningConfiguration", warningOption)); //$NON-NLS-1$
2164
							this.bind("configure.invalidWarningConfiguration", warningOption)); //$NON-NLS-1$
2166
					}
2165
					}
2167
					int warnTokenStart;
2166
					int warnTokenStart;
Lines 2218-2224 Link Here
2218
						handleWarningToken(token, isEnabling);
2217
						handleWarningToken(token, isEnabling);
2219
					}
2218
					}
2220
					if (tokenCounter == 0) {
2219
					if (tokenCounter == 0) {
2221
						throw new InvalidInputException(
2220
						throw new IllegalArgumentException(
2222
							this.bind("configure.invalidWarningOption", currentArg)); //$NON-NLS-1$
2221
							this.bind("configure.invalidWarningOption", currentArg)); //$NON-NLS-1$
2223
					}
2222
					}
2224
					continue;
2223
					continue;
Lines 2301-2307 Link Here
2301
				break;
2300
				break;
2302
			case INSIDE_TARGET :
2301
			case INSIDE_TARGET :
2303
				if (this.didSpecifyTarget) {
2302
				if (this.didSpecifyTarget) {
2304
					throw new InvalidInputException(
2303
					throw new IllegalArgumentException(
2305
						this.bind("configure.duplicateTarget", currentArg));//$NON-NLS-1$
2304
						this.bind("configure.duplicateTarget", currentArg));//$NON-NLS-1$
2306
				}
2305
				}
2307
				this.didSpecifyTarget = true;
2306
				this.didSpecifyTarget = true;
Lines 2325-2331 Link Here
2325
					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_CLDC1_1);
2324
					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_CLDC1_1);
2326
					this.options.put(CompilerOptions.OPTION_InlineJsr, CompilerOptions.ENABLED);
2325
					this.options.put(CompilerOptions.OPTION_InlineJsr, CompilerOptions.ENABLED);
2327
				}else {
2326
				}else {
2328
					throw new InvalidInputException(this.bind("configure.targetJDK", currentArg)); //$NON-NLS-1$
2327
					throw new IllegalArgumentException(this.bind("configure.targetJDK", currentArg)); //$NON-NLS-1$
2329
				}
2328
				}
2330
				mode = DEFAULT;
2329
				mode = DEFAULT;
2331
				continue;
2330
				continue;
Lines 2337-2346 Link Here
2337
				try {
2336
				try {
2338
					this.maxRepetition = Integer.parseInt(currentArg);
2337
					this.maxRepetition = Integer.parseInt(currentArg);
2339
					if (this.maxRepetition <= 0) {
2338
					if (this.maxRepetition <= 0) {
2340
						throw new InvalidInputException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$
2339
						throw new IllegalArgumentException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$
2341
					}
2340
					}
2342
				} catch (NumberFormatException e) {
2341
				} catch (NumberFormatException e) {
2343
					throw new InvalidInputException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$
2342
					throw new IllegalArgumentException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$
2344
				}
2343
				}
2345
				mode = DEFAULT;
2344
				mode = DEFAULT;
2346
				continue;
2345
				continue;
Lines 2348-2364 Link Here
2348
				try {
2347
				try {
2349
					this.maxProblems = Integer.parseInt(currentArg);
2348
					this.maxProblems = Integer.parseInt(currentArg);
2350
					if (this.maxProblems <= 0) {
2349
					if (this.maxProblems <= 0) {
2351
						throw new InvalidInputException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$
2350
						throw new IllegalArgumentException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$
2352
					}
2351
					}
2353
					this.options.put(CompilerOptions.OPTION_MaxProblemPerUnit, currentArg);
2352
					this.options.put(CompilerOptions.OPTION_MaxProblemPerUnit, currentArg);
2354
				} catch (NumberFormatException e) {
2353
				} catch (NumberFormatException e) {
2355
					throw new InvalidInputException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$
2354
					throw new IllegalArgumentException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$
2356
				}
2355
				}
2357
				mode = DEFAULT;
2356
				mode = DEFAULT;
2358
				continue;
2357
				continue;
2359
			case INSIDE_SOURCE :
2358
			case INSIDE_SOURCE :
2360
				if (this.didSpecifySource) {
2359
				if (this.didSpecifySource) {
2361
					throw new InvalidInputException(
2360
					throw new IllegalArgumentException(
2362
						this.bind("configure.duplicateSource", currentArg));//$NON-NLS-1$
2361
						this.bind("configure.duplicateSource", currentArg));//$NON-NLS-1$
2363
				}
2362
				}
2364
				this.didSpecifySource = true;
2363
				this.didSpecifySource = true;
Lines 2373-2391 Link Here
2373
				} else if (currentArg.equals("1.7") || currentArg.equals("7") || currentArg.equals("7.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
2372
				} else if (currentArg.equals("1.7") || currentArg.equals("7") || currentArg.equals("7.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
2374
					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7);
2373
					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7);
2375
				} else {
2374
				} else {
2376
					throw new InvalidInputException(this.bind("configure.source", currentArg)); //$NON-NLS-1$
2375
					throw new IllegalArgumentException(this.bind("configure.source", currentArg)); //$NON-NLS-1$
2377
				}
2376
				}
2378
				mode = DEFAULT;
2377
				mode = DEFAULT;
2379
				continue;
2378
				continue;
2380
			case INSIDE_DEFAULT_ENCODING :
2379
			case INSIDE_DEFAULT_ENCODING :
2381
				if (didSpecifyDefaultEncoding) {
2380
				if (didSpecifyDefaultEncoding) {
2382
					throw new InvalidInputException(
2381
					throw new IllegalArgumentException(
2383
						this.bind("configure.duplicateDefaultEncoding", currentArg)); //$NON-NLS-1$
2382
						this.bind("configure.duplicateDefaultEncoding", currentArg)); //$NON-NLS-1$
2384
				}
2383
				}
2385
				try { // ensure encoding is supported
2384
				try { // ensure encoding is supported
2386
					new InputStreamReader(new ByteArrayInputStream(new byte[0]), currentArg);
2385
					new InputStreamReader(new ByteArrayInputStream(new byte[0]), currentArg);
2387
				} catch (UnsupportedEncodingException e) {
2386
				} catch (UnsupportedEncodingException e) {
2388
					throw new InvalidInputException(
2387
					throw new IllegalArgumentException(
2389
						this.bind("configure.unsupportedEncoding", currentArg)); //$NON-NLS-1$
2388
						this.bind("configure.unsupportedEncoding", currentArg)); //$NON-NLS-1$
2390
				}
2389
				}
2391
				this.options.put(CompilerOptions.OPTION_Encoding, currentArg);
2390
				this.options.put(CompilerOptions.OPTION_Encoding, currentArg);
Lines 2412-2418 Link Here
2412
				continue;
2411
				continue;
2413
			case INSIDE_EXT_DIRS:
2412
			case INSIDE_EXT_DIRS:
2414
				if (currentArg.indexOf("[-d") != -1) { //$NON-NLS-1$
2413
				if (currentArg.indexOf("[-d") != -1) { //$NON-NLS-1$
2415
					throw new InvalidInputException(
2414
					throw new IllegalArgumentException(
2416
						this.bind("configure.unexpectedDestinationPathEntry", //$NON-NLS-1$
2415
						this.bind("configure.unexpectedDestinationPathEntry", //$NON-NLS-1$
2417
							"-extdir")); //$NON-NLS-1$
2416
							"-extdir")); //$NON-NLS-1$
2418
				}
2417
				}
Lines 2424-2430 Link Here
2424
				continue;
2423
				continue;
2425
			case INSIDE_ENDORSED_DIRS:
2424
			case INSIDE_ENDORSED_DIRS:
2426
				if (currentArg.indexOf("[-d") != -1) { //$NON-NLS-1$
2425
				if (currentArg.indexOf("[-d") != -1) { //$NON-NLS-1$
2427
					throw new InvalidInputException(
2426
					throw new IllegalArgumentException(
2428
						this.bind("configure.unexpectedDestinationPathEntry", //$NON-NLS-1$
2427
						this.bind("configure.unexpectedDestinationPathEntry", //$NON-NLS-1$
2429
							"-endorseddirs")); //$NON-NLS-1$
2428
							"-endorseddirs")); //$NON-NLS-1$
2430
				}				tokenizer = new StringTokenizer(currentArg,	File.pathSeparator, false);
2429
				}				tokenizer = new StringTokenizer(currentArg,	File.pathSeparator, false);
Lines 2438-2444 Link Here
2438
					customDestinationPath = currentArg.substring(0,
2437
					customDestinationPath = currentArg.substring(0,
2439
						currentArg.length() - 1);
2438
						currentArg.length() - 1);
2440
				} else {
2439
				} else {
2441
					throw new InvalidInputException(
2440
					throw new IllegalArgumentException(
2442
						this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$
2441
						this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$
2443
							"[-d " + currentArg)); //$NON-NLS-1$
2442
							"[-d " + currentArg)); //$NON-NLS-1$
2444
				}
2443
				}
Lines 2491-2497 Link Here
2491
		}
2490
		}
2492
		File dir = new File(currentSourceDirectory);
2491
		File dir = new File(currentSourceDirectory);
2493
		if (!dir.isDirectory()) {
2492
		if (!dir.isDirectory()) {
2494
			throw new InvalidInputException(
2493
			throw new IllegalArgumentException(
2495
				this.bind("configure.unrecognizedOption", currentSourceDirectory)); //$NON-NLS-1$
2494
				this.bind("configure.unrecognizedOption", currentSourceDirectory)); //$NON-NLS-1$
2496
		}
2495
		}
2497
		String[] result = FileFinder.find(dir, SuffixConstants.SUFFIX_STRING_JAVA);
2496
		String[] result = FileFinder.find(dir, SuffixConstants.SUFFIX_STRING_JAVA);
Lines 2718-2725 Link Here
2718
/*
2717
/*
2719
 *  Build the set of compilation source units
2718
 *  Build the set of compilation source units
2720
 */
2719
 */
2721
public CompilationUnit[] getCompilationUnits()
2720
public CompilationUnit[] getCompilationUnits() {
2722
	throws InvalidInputException {
2723
	int fileCount = this.filenames.length;
2721
	int fileCount = this.filenames.length;
2724
	CompilationUnit[] units = new CompilationUnit[fileCount];
2722
	CompilationUnit[] units = new CompilationUnit[fileCount];
2725
	HashtableOfObject knownFileNames = new HashtableOfObject(fileCount);
2723
	HashtableOfObject knownFileNames = new HashtableOfObject(fileCount);
Lines 2731-2741 Link Here
2731
	for (int i = 0; i < fileCount; i++) {
2729
	for (int i = 0; i < fileCount; i++) {
2732
		char[] charName = this.filenames[i].toCharArray();
2730
		char[] charName = this.filenames[i].toCharArray();
2733
		if (knownFileNames.get(charName) != null)
2731
		if (knownFileNames.get(charName) != null)
2734
			throw new InvalidInputException(this.bind("unit.more", this.filenames[i])); //$NON-NLS-1$
2732
			throw new IllegalArgumentException(this.bind("unit.more", this.filenames[i])); //$NON-NLS-1$
2735
		knownFileNames.put(charName, charName);
2733
		knownFileNames.put(charName, charName);
2736
		File file = new File(this.filenames[i]);
2734
		File file = new File(this.filenames[i]);
2737
		if (!file.exists())
2735
		if (!file.exists())
2738
			throw new InvalidInputException(this.bind("unit.missing", this.filenames[i])); //$NON-NLS-1$
2736
			throw new IllegalArgumentException(this.bind("unit.missing", this.filenames[i])); //$NON-NLS-1$
2739
		String encoding = this.encodings[i];
2737
		String encoding = this.encodings[i];
2740
		if (encoding == null)
2738
		if (encoding == null)
2741
			encoding = defaultEncoding;
2739
			encoding = defaultEncoding;
Lines 2791-2797 Link Here
2791
/*
2789
/*
2792
 * External API
2790
 * External API
2793
 */
2791
 */
2794
protected ArrayList handleBootclasspath(ArrayList bootclasspaths, String customEncoding) throws InvalidInputException {
2792
protected ArrayList handleBootclasspath(ArrayList bootclasspaths, String customEncoding) {
2795
 	final int bootclasspathsSize = bootclasspaths == null ? 0 : bootclasspaths.size();
2793
 	final int bootclasspathsSize = bootclasspaths == null ? 0 : bootclasspaths.size();
2796
	if (bootclasspathsSize != 0) {
2794
	if (bootclasspathsSize != 0) {
2797
		String[] paths = new String[bootclasspathsSize];
2795
		String[] paths = new String[bootclasspathsSize];
Lines 2878-2884 Link Here
2878
/*
2876
/*
2879
 * External API
2877
 * External API
2880
 */
2878
 */
2881
protected ArrayList handleClasspath(ArrayList classpaths, String customEncoding) throws InvalidInputException {
2879
protected ArrayList handleClasspath(ArrayList classpaths, String customEncoding) {
2882
	final int classpathsSize = classpaths == null ? 0 : classpaths.size();
2880
	final int classpathsSize = classpaths == null ? 0 : classpaths.size();
2883
	if (classpathsSize != 0) {
2881
	if (classpathsSize != 0) {
2884
		String[] paths = new String[classpathsSize];
2882
		String[] paths = new String[classpathsSize];
Lines 3063-3069 Link Here
3063
 * External API
3061
 * External API
3064
 * Handle a single warning token.
3062
 * Handle a single warning token.
3065
*/
3063
*/
3066
protected void handleWarningToken(String token, boolean isEnabling) throws InvalidInputException {
3064
protected void handleWarningToken(String token, boolean isEnabling) {
3067
	if (token.length() == 0) return;
3065
	if (token.length() == 0) return;
3068
	switch(token.charAt(0)) {
3066
	switch(token.charAt(0)) {
3069
		case 'a' :
3067
		case 'a' :
Lines 3399-3405 Link Here
3399
					taskTags = taskTags.replace('|',',');
3397
					taskTags = taskTags.replace('|',',');
3400
				}
3398
				}
3401
				if (taskTags.length() == 0){
3399
				if (taskTags.length() == 0){
3402
					throw new InvalidInputException(this.bind("configure.invalidTaskTag", token)); //$NON-NLS-1$
3400
					throw new IllegalArgumentException(this.bind("configure.invalidTaskTag", token)); //$NON-NLS-1$
3403
				}
3401
				}
3404
				this.options.put(
3402
				this.options.put(
3405
					CompilerOptions.OPTION_TaskTags,
3403
					CompilerOptions.OPTION_TaskTags,
Lines 3634-3640 Link Here
3634
/*
3632
/*
3635
 *  Low-level API performing the actual compilation
3633
 *  Low-level API performing the actual compilation
3636
 */
3634
 */
3637
public void performCompilation() throws InvalidInputException {
3635
public void performCompilation() {
3638
3636
3639
	this.startTime = System.currentTimeMillis();
3637
	this.startTime = System.currentTimeMillis();
3640
3638
Lines 3706-3712 Link Here
3706
			}));
3704
			}));
3707
	this.logger.flush();
3705
	this.logger.flush();
3708
}
3706
}
3709
private ReferenceBinding[] processClassNames(LookupEnvironment environment) throws InvalidInputException {
3707
private ReferenceBinding[] processClassNames(LookupEnvironment environment) {
3710
	// check for .class file presence in case of apt processing
3708
	// check for .class file presence in case of apt processing
3711
	int length = this.classNames.length;
3709
	int length = this.classNames.length;
3712
	ReferenceBinding[] referenceBindings = new ReferenceBinding[length];
3710
	ReferenceBinding[] referenceBindings = new ReferenceBinding[length];
Lines 3726-3732 Link Here
3726
				referenceBindings[i] = type;
3724
				referenceBindings[i] = type;
3727
			}
3725
			}
3728
		} else {
3726
		} else {
3729
			throw new InvalidInputException(
3727
			throw new IllegalArgumentException(
3730
					this.bind("configure.invalidClassName", currentName));//$NON-NLS-1$
3728
					this.bind("configure.invalidClassName", currentName));//$NON-NLS-1$
3731
		}
3729
		}
3732
	}
3730
	}
Lines 3737-3744 Link Here
3737
 */
3735
 */
3738
public void processPathEntries(final int defaultSize, final ArrayList paths,
3736
public void processPathEntries(final int defaultSize, final ArrayList paths,
3739
			final String currentPath, String customEncoding, boolean isSourceOnly,
3737
			final String currentPath, String customEncoding, boolean isSourceOnly,
3740
			boolean rejectDestinationPathOnJars)
3738
			boolean rejectDestinationPathOnJars) {
3741
		throws InvalidInputException {
3742
	String currentClasspathName = null;
3739
	String currentClasspathName = null;
3743
	String currentDestinationPath = null;
3740
	String currentDestinationPath = null;
3744
	ArrayList currentRuleSpecs = new ArrayList(defaultSize);
3741
	ArrayList currentRuleSpecs = new ArrayList(defaultSize);
Lines 3798-3804 Link Here
3798
				state = rulesNeedAnotherRule;
3795
				state = rulesNeedAnotherRule;
3799
				break;
3796
				break;
3800
			case destinationPathReadyToClose:
3797
			case destinationPathReadyToClose:
3801
				throw new InvalidInputException(
3798
				throw new IllegalArgumentException(
3802
					this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$
3799
					this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$
3803
						currentPath));
3800
						currentPath));
3804
			case bracketClosed:
3801
			case bracketClosed:
Lines 3855-3861 Link Here
3855
			case rulesStart:
3852
			case rulesStart:
3856
				if (token.startsWith("-d ")) { //$NON-NLS-1$
3853
				if (token.startsWith("-d ")) { //$NON-NLS-1$
3857
					if (currentDestinationPath != null) {
3854
					if (currentDestinationPath != null) {
3858
						throw new InvalidInputException(
3855
						throw new IllegalArgumentException(
3859
								this.bind("configure.duplicateDestinationPathEntry", //$NON-NLS-1$
3856
								this.bind("configure.duplicateDestinationPathEntry", //$NON-NLS-1$
3860
										currentPath));
3857
										currentPath));
3861
					}
3858
					}
Lines 3866-3872 Link Here
3866
				//$FALL-THROUGH$
3863
				//$FALL-THROUGH$
3867
			case rulesNeedAnotherRule:
3864
			case rulesNeedAnotherRule:
3868
				if (currentDestinationPath != null) {
3865
				if (currentDestinationPath != null) {
3869
					throw new InvalidInputException(
3866
					throw new IllegalArgumentException(
3870
							this.bind("configure.accessRuleAfterDestinationPath", //$NON-NLS-1$
3867
							this.bind("configure.accessRuleAfterDestinationPath", //$NON-NLS-1$
3871
								currentPath));
3868
								currentPath));
3872
				}
3869
				}
Lines 3918-3924 Link Here
3918
	}
3915
	}
3919
}
3916
}
3920
3917
3921
private int processPaths(String[] args, int index, String currentArg, ArrayList paths) throws InvalidInputException {
3918
private int processPaths(String[] args, int index, String currentArg, ArrayList paths) {
3922
	int localIndex = index;
3919
	int localIndex = index;
3923
	int count = 0;
3920
	int count = 0;
3924
	for (int i = 0, max = currentArg.length(); i < max; i++) {
3921
	for (int i = 0, max = currentArg.length(); i < max; i++) {
Lines 3934-3947 Link Here
3934
	if (count == 0) {
3931
	if (count == 0) {
3935
		paths.add(currentArg);
3932
		paths.add(currentArg);
3936
	} else if (count > 1) {
3933
	} else if (count > 1) {
3937
		throw new InvalidInputException(
3934
		throw new IllegalArgumentException(
3938
				this.bind("configure.unexpectedBracket", //$NON-NLS-1$
3935
				this.bind("configure.unexpectedBracket", //$NON-NLS-1$
3939
							currentArg));
3936
							currentArg));
3940
	} else {
3937
	} else {
3941
		StringBuffer currentPath = new StringBuffer(currentArg);
3938
		StringBuffer currentPath = new StringBuffer(currentArg);
3942
		while (true) {
3939
		while (true) {
3943
			if (localIndex >= args.length) {
3940
			if (localIndex >= args.length) {
3944
				throw new InvalidInputException(
3941
				throw new IllegalArgumentException(
3945
						this.bind("configure.unexpectedBracket", //$NON-NLS-1$
3942
						this.bind("configure.unexpectedBracket", //$NON-NLS-1$
3946
								currentArg));
3943
								currentArg));
3947
			}
3944
			}
Lines 3951-3957 Link Here
3951
				switch(nextArg.charAt(i)) {
3948
				switch(nextArg.charAt(i)) {
3952
					case '[' :
3949
					case '[' :
3953
						if (count > 1) {
3950
						if (count > 1) {
3954
							throw new InvalidInputException(
3951
							throw new IllegalArgumentException(
3955
									this.bind("configure.unexpectedBracket", //$NON-NLS-1$
3952
									this.bind("configure.unexpectedBracket", //$NON-NLS-1$
3956
											nextArg));
3953
											nextArg));
3957
						}
3954
						}
Lines 3968-3974 Link Here
3968
				paths.add(currentPath.toString());
3965
				paths.add(currentPath.toString());
3969
				return localIndex - index;
3966
				return localIndex - index;
3970
			} else if (count < 0) {
3967
			} else if (count < 0) {
3971
				throw new InvalidInputException(
3968
				throw new IllegalArgumentException(
3972
						this.bind("configure.unexpectedBracket", //$NON-NLS-1$
3969
						this.bind("configure.unexpectedBracket", //$NON-NLS-1$
3973
									nextArg));
3970
									nextArg));
3974
			} else {
3971
			} else {
Lines 3980-3986 Link Here
3980
	}
3977
	}
3981
	return localIndex - index;
3978
	return localIndex - index;
3982
}
3979
}
3983
private int processPaths(String[] args, int index, String currentArg, String[] paths) throws InvalidInputException {
3980
private int processPaths(String[] args, int index, String currentArg, String[] paths) {
3984
	int localIndex = index;
3981
	int localIndex = index;
3985
	int count = 0;
3982
	int count = 0;
3986
	for (int i = 0, max = currentArg.length(); i < max; i++) {
3983
	for (int i = 0, max = currentArg.length(); i < max; i++) {
Lines 4000-4006 Link Here
4000
		while (true) {
3997
		while (true) {
4001
			localIndex++;
3998
			localIndex++;
4002
			if (localIndex >= args.length) {
3999
			if (localIndex >= args.length) {
4003
				throw new InvalidInputException(
4000
				throw new IllegalArgumentException(
4004
						this.bind("configure.unexpectedBracket", //$NON-NLS-1$
4001
						this.bind("configure.unexpectedBracket", //$NON-NLS-1$
4005
								currentArg));
4002
								currentArg));
4006
			}
4003
			}
Lines 4009-4015 Link Here
4009
				switch(nextArg.charAt(i)) {
4006
				switch(nextArg.charAt(i)) {
4010
					case '[' :
4007
					case '[' :
4011
						if (count > 1) {
4008
						if (count > 1) {
4012
							throw new InvalidInputException(
4009
							throw new IllegalArgumentException(
4013
									this.bind("configure.unexpectedBracket", //$NON-NLS-1$
4010
									this.bind("configure.unexpectedBracket", //$NON-NLS-1$
4014
											currentArg));
4011
											currentArg));
4015
						}
4012
						}
Lines 4026-4032 Link Here
4026
				paths[0] = currentPath.toString();
4023
				paths[0] = currentPath.toString();
4027
				return localIndex - index;
4024
				return localIndex - index;
4028
			} else if (count < 0) {
4025
			} else if (count < 0) {
4029
				throw new InvalidInputException(
4026
				throw new IllegalArgumentException(
4030
						this.bind("configure.unexpectedBracket", //$NON-NLS-1$
4027
						this.bind("configure.unexpectedBracket", //$NON-NLS-1$
4031
									currentArg));
4028
									currentArg));
4032
			} else {
4029
			} else {
Lines 4075-4081 Link Here
4075
		ArrayList classpaths,
4072
		ArrayList classpaths,
4076
		ArrayList extdirsClasspaths,
4073
		ArrayList extdirsClasspaths,
4077
		ArrayList endorsedDirClasspaths,
4074
		ArrayList endorsedDirClasspaths,
4078
		String customEncoding) throws InvalidInputException {
4075
		String customEncoding) {
4079
4076
4080
	// process bootclasspath, classpath and sourcepaths
4077
	// process bootclasspath, classpath and sourcepaths
4081
 	bootclasspaths = handleBootclasspath(bootclasspaths, customEncoding);
4078
 	bootclasspaths = handleBootclasspath(bootclasspaths, customEncoding);
Lines 4115-4121 Link Here
4115
	classpaths.toArray(this.checkedClasspaths);
4112
	classpaths.toArray(this.checkedClasspaths);
4116
	this.logger.logClasspath(this.checkedClasspaths);
4113
	this.logger.logClasspath(this.checkedClasspaths);
4117
}
4114
}
4118
protected void validateOptions(boolean didSpecifyCompliance) throws InvalidInputException {
4115
protected void validateOptions(boolean didSpecifyCompliance) {
4119
	if (didSpecifyCompliance) {
4116
	if (didSpecifyCompliance) {
4120
		Object version = this.options.get(CompilerOptions.OPTION_Compliance);
4117
		Object version = this.options.get(CompilerOptions.OPTION_Compliance);
4121
		if (CompilerOptions.VERSION_1_3.equals(version)) {
4118
		if (CompilerOptions.VERSION_1_3.equals(version)) {
Lines 4200-4218 Link Here
4200
	if (sourceVersion.equals(CompilerOptions.VERSION_1_7)
4197
	if (sourceVersion.equals(CompilerOptions.VERSION_1_7)
4201
			&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_7) {
4198
			&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_7) {
4202
		// compliance must be 1.7 if source is 1.7
4199
		// compliance must be 1.7 if source is 1.7
4203
		throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_7)); //$NON-NLS-1$
4200
		throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_7)); //$NON-NLS-1$
4204
	} else if (sourceVersion.equals(CompilerOptions.VERSION_1_6)
4201
	} else if (sourceVersion.equals(CompilerOptions.VERSION_1_6)
4205
			&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_6) {
4202
			&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_6) {
4206
		// compliance must be 1.6 if source is 1.6
4203
		// compliance must be 1.6 if source is 1.6
4207
		throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_6)); //$NON-NLS-1$
4204
		throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_6)); //$NON-NLS-1$
4208
	} else if (sourceVersion.equals(CompilerOptions.VERSION_1_5)
4205
	} else if (sourceVersion.equals(CompilerOptions.VERSION_1_5)
4209
			&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_5) {
4206
			&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_5) {
4210
		// compliance must be 1.5 if source is 1.5
4207
		// compliance must be 1.5 if source is 1.5
4211
		throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$
4208
		throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$
4212
	} else if (sourceVersion.equals(CompilerOptions.VERSION_1_4)
4209
	} else if (sourceVersion.equals(CompilerOptions.VERSION_1_4)
4213
			&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_4) {
4210
			&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_4) {
4214
		// compliance must be 1.4 if source is 1.4
4211
		// compliance must be 1.4 if source is 1.4
4215
		throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_4)); //$NON-NLS-1$
4212
		throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_4)); //$NON-NLS-1$
4216
	}
4213
	}
4217
4214
4218
	// check and set compliance/source/target compatibilities
4215
	// check and set compliance/source/target compatibilities
Lines 4222-4260 Link Here
4222
		if (CompilerOptions.VERSION_JSR14.equals(targetVersion)) {
4219
		if (CompilerOptions.VERSION_JSR14.equals(targetVersion)) {
4223
			// expecting source >= 1.5
4220
			// expecting source >= 1.5
4224
			if (CompilerOptions.versionToJdkLevel(sourceVersion) < ClassFileConstants.JDK1_5) {
4221
			if (CompilerOptions.versionToJdkLevel(sourceVersion) < ClassFileConstants.JDK1_5) {
4225
				throw new InvalidInputException(this.bind("configure.incompatibleTargetForGenericSource", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$
4222
				throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForGenericSource", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$
4226
			}
4223
			}
4227
		} else if (CompilerOptions.VERSION_CLDC1_1.equals(targetVersion)) {
4224
		} else if (CompilerOptions.VERSION_CLDC1_1.equals(targetVersion)) {
4228
			if (this.didSpecifySource && CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_4) {
4225
			if (this.didSpecifySource && CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_4) {
4229
				throw new InvalidInputException(this.bind("configure.incompatibleSourceForCldcTarget", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$
4226
				throw new IllegalArgumentException(this.bind("configure.incompatibleSourceForCldcTarget", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$
4230
			}
4227
			}
4231
			if (CompilerOptions.versionToJdkLevel(compliance) >= ClassFileConstants.JDK1_5) {
4228
			if (CompilerOptions.versionToJdkLevel(compliance) >= ClassFileConstants.JDK1_5) {
4232
				throw new InvalidInputException(this.bind("configure.incompatibleComplianceForCldcTarget", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$
4229
				throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForCldcTarget", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$
4233
			}
4230
			}
4234
		} else {
4231
		} else {
4235
			// target must be 1.7 if source is 1.7
4232
			// target must be 1.7 if source is 1.7
4236
			if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_7
4233
			if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_7
4237
					&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_7){
4234
					&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_7){
4238
				throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_7)); //$NON-NLS-1$
4235
				throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_7)); //$NON-NLS-1$
4239
			}
4236
			}
4240
			// target must be 1.6 if source is 1.6
4237
			// target must be 1.6 if source is 1.6
4241
			if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_6
4238
			if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_6
4242
					&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_6){
4239
					&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_6){
4243
				throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_6)); //$NON-NLS-1$
4240
				throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_6)); //$NON-NLS-1$
4244
			}
4241
			}
4245
			// target must be 1.5 if source is 1.5
4242
			// target must be 1.5 if source is 1.5
4246
			if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_5
4243
			if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_5
4247
					&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_5){
4244
					&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_5){
4248
				throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_5)); //$NON-NLS-1$
4245
				throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_5)); //$NON-NLS-1$
4249
			}
4246
			}
4250
			// target must be 1.4 if source is 1.4
4247
			// target must be 1.4 if source is 1.4
4251
			if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_4
4248
			if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_4
4252
					&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_4){
4249
					&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_4){
4253
				throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_4)); //$NON-NLS-1$
4250
				throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_4)); //$NON-NLS-1$
4254
			}
4251
			}
4255
			// target cannot be greater than compliance level
4252
			// target cannot be greater than compliance level
4256
			if (CompilerOptions.versionToJdkLevel(compliance) < CompilerOptions.versionToJdkLevel(targetVersion)){
4253
			if (CompilerOptions.versionToJdkLevel(compliance) < CompilerOptions.versionToJdkLevel(targetVersion)){
4257
				throw new InvalidInputException(this.bind("configure.incompatibleComplianceForTarget", (String)this.options.get(CompilerOptions.OPTION_Compliance), (String) targetVersion)); //$NON-NLS-1$
4254
				throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForTarget", (String)this.options.get(CompilerOptions.OPTION_Compliance), (String) targetVersion)); //$NON-NLS-1$
4258
			}
4255
			}
4259
		}
4256
		}
4260
	}
4257
	}
(-)src/org/eclipse/jdt/core/tests/util/Util.java (-1 / +3 lines)
Lines 1284-1290 Link Here
1284
	        	throw new IOException("Could not delete " + zipPath);
1284
	        	throw new IOException("Could not delete " + zipPath);
1285
        	 // ensure the new zip file has a different timestamp than the previous one
1285
        	 // ensure the new zip file has a different timestamp than the previous one
1286
        	int timeToWait = 1000; // some platform (like Linux) have a 1s granularity)
1286
        	int timeToWait = 1000; // some platform (like Linux) have a 1s granularity)
1287
           	waitAtLeast(timeToWait);
1287
            waitAtLeast(timeToWait);
1288
        } else {
1289
        	zipFile.getParentFile().mkdirs();
1288
        }
1290
        }
1289
        zip = new ZipOutputStream(new FileOutputStream(zipFile));
1291
        zip = new ZipOutputStream(new FileOutputStream(zipFile));
1290
        zip(rootDir, zip, rootDir.getPath().length()+1); // 1 for last slash
1292
        zip(rootDir, zip, rootDir.getPath().length()+1); // 1 for last slash
(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (-4 / +4 lines)
Lines 29-35 Link Here
29
import org.eclipse.jdt.core.JavaCore;
29
import org.eclipse.jdt.core.JavaCore;
30
import org.eclipse.jdt.core.compiler.CharOperation;
30
import org.eclipse.jdt.core.compiler.CharOperation;
31
import org.eclipse.jdt.core.compiler.CompilationProgress;
31
import org.eclipse.jdt.core.compiler.CompilationProgress;
32
import org.eclipse.jdt.core.compiler.InvalidInputException;
33
import org.eclipse.jdt.core.compiler.batch.BatchCompiler;
32
import org.eclipse.jdt.core.compiler.batch.BatchCompiler;
34
import org.eclipse.jdt.core.tests.util.Util;
33
import org.eclipse.jdt.core.tests.util.Util;
35
import org.eclipse.jdt.internal.compiler.batch.ClasspathJar;
34
import org.eclipse.jdt.internal.compiler.batch.ClasspathJar;
Lines 756-762 Link Here
756
	try {
755
	try {
757
		(new Main(new PrintWriter(System.out), new PrintWriter(System.err), true/*systemExit*/, null/*options*/, null/*progress*/)).
756
		(new Main(new PrintWriter(System.out), new PrintWriter(System.err), true/*systemExit*/, null/*options*/, null/*progress*/)).
758
			processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, classpathInput, null /* customEncoding */, true /* isSourceOnly */, false /* rejectDestinationPathOnJars*/);
757
			processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, classpathInput, null /* customEncoding */, true /* isSourceOnly */, false /* rejectDestinationPathOnJars*/);
759
	} catch (InvalidInputException e) {
758
	} catch (IllegalArgumentException e) {
760
		// e.printStackTrace();
759
		// e.printStackTrace();
761
		if (expectedError == null) {
760
		if (expectedError == null) {
762
			fail("unexpected invalid input exception: " + e.getMessage());
761
			fail("unexpected invalid input exception: " + e.getMessage());
Lines 2418-2424 Link Here
2418
	}
2417
	}
2419
//	 https://bugs.eclipse.org/bugs/show_bug.cgi?id=88364 - cumulative -extdirs extends the classpath
2418
//	 https://bugs.eclipse.org/bugs/show_bug.cgi?id=88364 - cumulative -extdirs extends the classpath
2420
	public void test025(){
2419
	public void test025(){
2421
		String path = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
2420
		String path = org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.LIB_DIR;
2422
		String libPath = null;
2421
		String libPath = null;
2423
		if (path.endsWith(File.separator)) {
2422
		if (path.endsWith(File.separator)) {
2424
			libPath = path + "lib.jar";
2423
			libPath = path + "lib.jar";
Lines 2437-2443 Link Here
2437
				JavaCore.VERSION_1_4);
2436
				JavaCore.VERSION_1_4);
2438
			jarCreated = true;
2437
			jarCreated = true;
2439
		} catch (IOException e) {
2438
		} catch (IOException e) {
2440
			// ignore
2439
			e.printStackTrace();
2440
			assertTrue("Should not happen", false);
2441
		}
2441
		}
2442
		String setting= System.getProperty("jdt.compiler.useSingleThread");
2442
		String setting= System.getProperty("jdt.compiler.useSingleThread");
2443
		try {
2443
		try {

Return to bug 255974