### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.compiler.tool Index: src/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java,v retrieving revision 1.7 diff -u -r1.7 EclipseCompilerImpl.java --- src/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java 11 Apr 2008 19:42:35 -0000 1.7 +++ src/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java 20 Nov 2008 15:43:06 -0000 @@ -31,7 +31,6 @@ import org.eclipse.jdt.core.compiler.CategorizedProblem; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.compiler.CompilationProgress; -import org.eclipse.jdt.core.compiler.InvalidInputException; import org.eclipse.jdt.internal.compiler.ClassFile; import org.eclipse.jdt.internal.compiler.CompilationResult; import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy; @@ -69,15 +68,13 @@ // request compilation performCompilation(); } - } catch (InvalidInputException e) { + } catch(IllegalArgumentException e) { this.logger.logException(e); if (this.systemExitWhenFinished) { cleanup(); System.exit(-1); } return false; - } catch(IllegalArgumentException e) { - throw e; } catch (RuntimeException e) { // internal compiler failure this.logger.logException(e); return false; @@ -319,7 +316,7 @@ ArrayList classpaths, ArrayList extdirsClasspaths, ArrayList endorsedDirClasspaths, - String customEncoding) throws InvalidInputException { + String customEncoding) { ArrayList fileSystemClasspaths = new ArrayList(); EclipseFileManager javaFileManager = null; Index: src/org/eclipse/jdt/internal/compiler/tool/EclipseCompiler.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/EclipseCompiler.java,v retrieving revision 1.22 diff -u -r1.22 EclipseCompiler.java --- src/org/eclipse/jdt/internal/compiler/tool/EclipseCompiler.java 14 Apr 2008 11:28:27 -0000 1.22 +++ src/org/eclipse/jdt/internal/compiler/tool/EclipseCompiler.java 20 Nov 2008 15:43:06 -0000 @@ -35,7 +35,6 @@ import javax.tools.StandardJavaFileManager; import javax.tools.StandardLocation; -import org.eclipse.jdt.core.compiler.InvalidInputException; import org.eclipse.jdt.internal.compiler.batch.Main; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; @@ -167,8 +166,8 @@ allOptions.toArray(optionsToProcess); try { eclipseCompiler2.configure(optionsToProcess); - } catch (InvalidInputException e) { - throw new RuntimeException(e); + } catch (IllegalArgumentException e) { + throw e; } if (eclipseCompiler2.fileManager instanceof StandardJavaFileManager) { Index: src/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java,v retrieving revision 1.8 diff -u -r1.8 EclipseFileManager.java --- src/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java 16 Apr 2008 07:31:20 -0000 1.8 +++ src/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java 20 Nov 2008 15:43:06 -0000 @@ -38,7 +38,6 @@ import javax.tools.JavaFileObject.Kind; import org.eclipse.jdt.core.compiler.IProblem; -import org.eclipse.jdt.core.compiler.InvalidInputException; import org.eclipse.jdt.internal.compiler.batch.FileSystem; import org.eclipse.jdt.internal.compiler.batch.Main; import org.eclipse.jdt.internal.compiler.batch.Main.ResourceBundleFactory; @@ -276,7 +275,7 @@ ArrayList files = new ArrayList(); try { this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false); - } catch (InvalidInputException e) { + } catch (IllegalArgumentException e) { return null; } for (FileSystem.Classpath classpath : paths) { @@ -346,7 +345,7 @@ ArrayList files = new ArrayList(); try { this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false); - } catch (InvalidInputException e) { + } catch (IllegalArgumentException e) { return null; } for (FileSystem.Classpath classpath : paths) { @@ -360,7 +359,7 @@ ArrayList files = new ArrayList(); try { this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false); - } catch (InvalidInputException e) { + } catch (IllegalArgumentException e) { return null; } for (FileSystem.Classpath classpath : paths) { @@ -854,8 +853,8 @@ @SuppressWarnings("unchecked") public void processPathEntries(final int defaultSize, final ArrayList paths, final String currentPath, String customEncoding, boolean isSourceOnly, - boolean rejectDestinationPathOnJars) - throws InvalidInputException { + boolean rejectDestinationPathOnJars) { + String currentClasspathName = null; String currentDestinationPath = null; ArrayList currentRuleSpecs = new ArrayList(defaultSize); @@ -915,7 +914,7 @@ state = rulesNeedAnotherRule; break; case destinationPathReadyToClose: - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ currentPath)); case bracketClosed: @@ -970,7 +969,7 @@ case rulesStart: if (token.startsWith("-d ")) { //$NON-NLS-1$ if (currentDestinationPath != null) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateDestinationPathEntry", //$NON-NLS-1$ currentPath)); } @@ -980,7 +979,7 @@ } // else we proceed with a rule case rulesNeedAnotherRule: if (currentDestinationPath != null) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.accessRuleAfterDestinationPath", //$NON-NLS-1$ currentPath)); } @@ -1032,7 +1031,7 @@ protected void addNewEntry(ArrayList paths, String currentClasspathName, ArrayList currentRuleSpecs, String customEncoding, String destPath, boolean isSourceOnly, - boolean rejectDestinationPathOnJars) throws InvalidInputException { + boolean rejectDestinationPathOnJars) { int rulesSpecsSize = currentRuleSpecs.size(); AccessRuleSet accessRuleSet = null; @@ -1085,7 +1084,7 @@ if (rejectDestinationPathOnJars && destPath != null && (currentClasspathName.endsWith(".jar") || //$NON-NLS-1$ currentClasspathName.endsWith(".zip"))) { //$NON-NLS-1$ - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedDestinationPathEntryFile", //$NON-NLS-1$ currentClasspathName)); } #P org.eclipse.jdt.compiler.apt Index: src/org/eclipse/jdt/internal/compiler/apt/util/EclipseFileManager.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/util/EclipseFileManager.java,v retrieving revision 1.5 diff -u -r1.5 EclipseFileManager.java --- src/org/eclipse/jdt/internal/compiler/apt/util/EclipseFileManager.java 15 Nov 2007 17:49:13 -0000 1.5 +++ src/org/eclipse/jdt/internal/compiler/apt/util/EclipseFileManager.java 20 Nov 2008 15:43:06 -0000 @@ -38,7 +38,6 @@ import javax.tools.JavaFileObject.Kind; import org.eclipse.jdt.core.compiler.IProblem; -import org.eclipse.jdt.core.compiler.InvalidInputException; import org.eclipse.jdt.internal.compiler.batch.FileSystem; import org.eclipse.jdt.internal.compiler.batch.Main; import org.eclipse.jdt.internal.compiler.batch.Main.ResourceBundleFactory; @@ -276,7 +275,7 @@ ArrayList files = new ArrayList(); try { this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false); - } catch (InvalidInputException e) { + } catch (IllegalArgumentException e) { return null; } for (FileSystem.Classpath classpath : paths) { @@ -346,7 +345,7 @@ ArrayList files = new ArrayList(); try { this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false); - } catch (InvalidInputException e) { + } catch (IllegalArgumentException e) { return null; } for (FileSystem.Classpath classpath : paths) { @@ -360,7 +359,7 @@ ArrayList files = new ArrayList(); try { this.processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, path, this.charset.toString(), false, false); - } catch (InvalidInputException e) { + } catch (IllegalArgumentException e) { return null; } for (FileSystem.Classpath classpath : paths) { @@ -872,8 +871,7 @@ @SuppressWarnings("unchecked") public void processPathEntries(final int defaultSize, final ArrayList paths, final String currentPath, String customEncoding, boolean isSourceOnly, - boolean rejectDestinationPathOnJars) - throws InvalidInputException { + boolean rejectDestinationPathOnJars) { String currentClasspathName = null; String currentDestinationPath = null; ArrayList currentRuleSpecs = new ArrayList(defaultSize); @@ -933,7 +931,7 @@ state = rulesNeedAnotherRule; break; case destinationPathReadyToClose: - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ currentPath)); case bracketClosed: @@ -988,7 +986,7 @@ case rulesStart: if (token.startsWith("-d ")) { //$NON-NLS-1$ if (currentDestinationPath != null) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateDestinationPathEntry", //$NON-NLS-1$ currentPath)); } @@ -998,7 +996,7 @@ } // else we proceed with a rule case rulesNeedAnotherRule: if (currentDestinationPath != null) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.accessRuleAfterDestinationPath", //$NON-NLS-1$ currentPath)); } @@ -1050,7 +1048,7 @@ protected void addNewEntry(ArrayList paths, String currentClasspathName, ArrayList currentRuleSpecs, String customEncoding, String destPath, boolean isSourceOnly, - boolean rejectDestinationPathOnJars) throws InvalidInputException { + boolean rejectDestinationPathOnJars) { int rulesSpecsSize = currentRuleSpecs.size(); AccessRuleSet accessRuleSet = null; @@ -1103,7 +1101,7 @@ if (rejectDestinationPathOnJars && destPath != null && (currentClasspathName.endsWith(".jar") || //$NON-NLS-1$ currentClasspathName.endsWith(".zip"))) { //$NON-NLS-1$ - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedDestinationPathEntryFile", //$NON-NLS-1$ currentClasspathName)); } #P org.eclipse.jdt.core Index: batch/org/eclipse/jdt/internal/compiler/batch/Main.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java,v retrieving revision 1.335 diff -u -r1.335 Main.java --- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 10 Oct 2008 17:24:31 -0000 1.335 +++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 20 Nov 2008 15:43:07 -0000 @@ -47,7 +47,6 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.compiler.CompilationProgress; import org.eclipse.jdt.core.compiler.IProblem; -import org.eclipse.jdt.core.compiler.InvalidInputException; import org.eclipse.jdt.core.compiler.batch.BatchCompiler; import org.eclipse.jdt.internal.compiler.AbstractAnnotationProcessorManager; import org.eclipse.jdt.internal.compiler.ClassFile; @@ -1138,7 +1137,7 @@ public void setEmacs() { this.tagBits |= Logger.EMACS; } - public void setLog(String logFileName) throws InvalidInputException { + public void setLog(String logFileName) { final Date date = new Date(); final DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG, Locale.getDefault()); try { @@ -1167,9 +1166,9 @@ this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$ } } catch (FileNotFoundException e) { - throw new InvalidInputException(this.main.bind("configure.cannotOpenLog", logFileName)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.main.bind("configure.cannotOpenLog", logFileName)); //$NON-NLS-1$ } catch (UnsupportedEncodingException e) { - throw new InvalidInputException(this.main.bind("configure.cannotOpenLogInvalidEncoding", logFileName)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.main.bind("configure.cannotOpenLogInvalidEncoding", logFileName)); //$NON-NLS-1$ } } private void startLoggingExtraProblems(int count) { @@ -1450,7 +1449,7 @@ protected void addNewEntry(ArrayList paths, String currentClasspathName, ArrayList currentRuleSpecs, String customEncoding, String destPath, boolean isSourceOnly, - boolean rejectDestinationPathOnJars) throws InvalidInputException { + boolean rejectDestinationPathOnJars) { int rulesSpecsSize = currentRuleSpecs.size(); AccessRuleSet accessRuleSet = null; @@ -1506,7 +1505,7 @@ } if (rejectDestinationPathOnJars && destPath != null && Util.isPotentialZipArchive(currentClasspathName)) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedDestinationPathEntryFile", //$NON-NLS-1$ currentClasspathName)); } @@ -1662,7 +1661,7 @@ this.logger.close(); System.exit(this.globalErrorsCount > 0 ? -1 : 0); } - } catch (InvalidInputException e) { + } catch (IllegalArgumentException e) { this.logger.logException(e); if (this.systemExitWhenFinished) { this.logger.flush(); @@ -1692,7 +1691,7 @@ /* Decode the command line arguments */ -public void configure(String[] argv) throws InvalidInputException { +public void configure(String[] argv) { if ((argv == null) || (argv.length == 0)) { printUsage(); @@ -1774,7 +1773,7 @@ } newArgs = tokenize(buffer.toString()); } catch(IOException e) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.invalidexpansionargumentname", arg)); //$NON-NLS-1$ } } @@ -1800,7 +1799,7 @@ while (++index < argCount) { if (customEncoding != null) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedCustomEncoding", currentArg, customEncoding)); //$NON-NLS-1$ } @@ -1809,7 +1808,7 @@ switch(mode) { case DEFAULT : if (currentArg.startsWith("[")) { //$NON-NLS-1$ - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedBracket", //$NON-NLS-1$ currentArg)); } @@ -1818,7 +1817,7 @@ // look for encoding specification int encodingStart = currentArg.indexOf('[') + 1; if (encodingStart <= 1) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedBracket", currentArg)); //$NON-NLS-1$ } int encodingEnd = currentArg.length() - 1; @@ -1828,7 +1827,7 @@ try { // ensure encoding is supported new InputStreamReader(new ByteArrayInputStream(new byte[0]), customEncoding); } catch (UnsupportedEncodingException e) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unsupportedEncoding", customEncoding)); //$NON-NLS-1$ } } @@ -1871,21 +1870,21 @@ } if (currentArg.equals("-log")) { //$NON-NLS-1$ if (this.log != null) - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateLog", currentArg)); //$NON-NLS-1$ mode = INSIDE_LOG; continue; } if (currentArg.equals("-repeat")) { //$NON-NLS-1$ if (this.maxRepetition > 0) - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateRepeat", currentArg)); //$NON-NLS-1$ mode = INSIDE_REPETITION; continue; } if (currentArg.equals("-maxProblems")) { //$NON-NLS-1$ if (this.maxProblems > 0) - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateMaxProblems", currentArg)); //$NON-NLS-1$ mode = INSIDE_MAX_PROBLEMS; continue; @@ -1900,7 +1899,7 @@ } if (currentArg.equals("-1.3")) { //$NON-NLS-1$ if (didSpecifyCompliance) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateCompliance", currentArg));//$NON-NLS-1$ } didSpecifyCompliance = true; @@ -1910,7 +1909,7 @@ } if (currentArg.equals("-1.4")) { //$NON-NLS-1$ if (didSpecifyCompliance) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$ } didSpecifyCompliance = true; @@ -1920,7 +1919,7 @@ } if (currentArg.equals("-1.5") || currentArg.equals("-5") || currentArg.equals("-5.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (didSpecifyCompliance) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$ } didSpecifyCompliance = true; @@ -1930,7 +1929,7 @@ } if (currentArg.equals("-1.6") || currentArg.equals("-6") || currentArg.equals("-6.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (didSpecifyCompliance) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$ } didSpecifyCompliance = true; @@ -1940,7 +1939,7 @@ } if (currentArg.equals("-1.7") || currentArg.equals("-7") || currentArg.equals("-7.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (didSpecifyCompliance) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$ } didSpecifyCompliance = true; @@ -1956,7 +1955,7 @@ errorMessage.append(' '); errorMessage.append(newCommandLineArgs[index + 1]); } - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateOutputPath", errorMessage.toString())); //$NON-NLS-1$ } mode = INSIDE_DESTINATION_PATH; @@ -1975,7 +1974,7 @@ errorMessage.append(' '); errorMessage.append(newCommandLineArgs[index + 1]); } - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateBootClasspath", errorMessage.toString())); //$NON-NLS-1$ } mode = INSIDE_BOOTCLASSPATH_start; @@ -1989,7 +1988,7 @@ errorMessage.append(' '); errorMessage.append(newCommandLineArgs[index + 1]); } - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateSourcepath", errorMessage.toString())); //$NON-NLS-1$ } mode = INSIDE_SOURCE_PATH_start; @@ -2003,7 +2002,7 @@ errorMessage.append(' '); errorMessage.append(newCommandLineArgs[index + 1]); } - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateExtDirs", errorMessage.toString())); //$NON-NLS-1$ } mode = INSIDE_EXT_DIRS; @@ -2017,7 +2016,7 @@ errorMessage.append(' '); errorMessage.append(newCommandLineArgs[index + 1]); } - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateEndorsedDirs", errorMessage.toString())); //$NON-NLS-1$ } mode = INSIDE_ENDORSED_DIRS; @@ -2138,13 +2137,13 @@ CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE); } else { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.invalidDebugOption", debugOption)); //$NON-NLS-1$ } } continue; } - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.invalidDebugOption", debugOption)); //$NON-NLS-1$ } if (currentArg.startsWith("-nowarn")) { //$NON-NLS-1$ @@ -2161,7 +2160,7 @@ continue; } if (length <= 6) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.invalidWarningConfiguration", warningOption)); //$NON-NLS-1$ } int warnTokenStart; @@ -2218,7 +2217,7 @@ handleWarningToken(token, isEnabling); } if (tokenCounter == 0) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.invalidWarningOption", currentArg)); //$NON-NLS-1$ } continue; @@ -2301,7 +2300,7 @@ break; case INSIDE_TARGET : if (this.didSpecifyTarget) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateTarget", currentArg));//$NON-NLS-1$ } this.didSpecifyTarget = true; @@ -2325,7 +2324,7 @@ this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_CLDC1_1); this.options.put(CompilerOptions.OPTION_InlineJsr, CompilerOptions.ENABLED); }else { - throw new InvalidInputException(this.bind("configure.targetJDK", currentArg)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.targetJDK", currentArg)); //$NON-NLS-1$ } mode = DEFAULT; continue; @@ -2337,10 +2336,10 @@ try { this.maxRepetition = Integer.parseInt(currentArg); if (this.maxRepetition <= 0) { - throw new InvalidInputException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$ } } catch (NumberFormatException e) { - throw new InvalidInputException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$ } mode = DEFAULT; continue; @@ -2348,17 +2347,17 @@ try { this.maxProblems = Integer.parseInt(currentArg); if (this.maxProblems <= 0) { - throw new InvalidInputException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$ } this.options.put(CompilerOptions.OPTION_MaxProblemPerUnit, currentArg); } catch (NumberFormatException e) { - throw new InvalidInputException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$ } mode = DEFAULT; continue; case INSIDE_SOURCE : if (this.didSpecifySource) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateSource", currentArg));//$NON-NLS-1$ } this.didSpecifySource = true; @@ -2373,19 +2372,19 @@ } else if (currentArg.equals("1.7") || currentArg.equals("7") || currentArg.equals("7.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7); } else { - throw new InvalidInputException(this.bind("configure.source", currentArg)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.source", currentArg)); //$NON-NLS-1$ } mode = DEFAULT; continue; case INSIDE_DEFAULT_ENCODING : if (didSpecifyDefaultEncoding) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateDefaultEncoding", currentArg)); //$NON-NLS-1$ } try { // ensure encoding is supported new InputStreamReader(new ByteArrayInputStream(new byte[0]), currentArg); } catch (UnsupportedEncodingException e) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unsupportedEncoding", currentArg)); //$NON-NLS-1$ } this.options.put(CompilerOptions.OPTION_Encoding, currentArg); @@ -2412,7 +2411,7 @@ continue; case INSIDE_EXT_DIRS: if (currentArg.indexOf("[-d") != -1) { //$NON-NLS-1$ - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedDestinationPathEntry", //$NON-NLS-1$ "-extdir")); //$NON-NLS-1$ } @@ -2424,7 +2423,7 @@ continue; case INSIDE_ENDORSED_DIRS: if (currentArg.indexOf("[-d") != -1) { //$NON-NLS-1$ - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedDestinationPathEntry", //$NON-NLS-1$ "-endorseddirs")); //$NON-NLS-1$ } tokenizer = new StringTokenizer(currentArg, File.pathSeparator, false); @@ -2438,7 +2437,7 @@ customDestinationPath = currentArg.substring(0, currentArg.length() - 1); } else { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ "[-d " + currentArg)); //$NON-NLS-1$ } @@ -2491,7 +2490,7 @@ } File dir = new File(currentSourceDirectory); if (!dir.isDirectory()) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unrecognizedOption", currentSourceDirectory)); //$NON-NLS-1$ } String[] result = FileFinder.find(dir, SuffixConstants.SUFFIX_STRING_JAVA); @@ -2718,8 +2717,7 @@ /* * Build the set of compilation source units */ -public CompilationUnit[] getCompilationUnits() - throws InvalidInputException { +public CompilationUnit[] getCompilationUnits() { int fileCount = this.filenames.length; CompilationUnit[] units = new CompilationUnit[fileCount]; HashtableOfObject knownFileNames = new HashtableOfObject(fileCount); @@ -2731,11 +2729,11 @@ for (int i = 0; i < fileCount; i++) { char[] charName = this.filenames[i].toCharArray(); if (knownFileNames.get(charName) != null) - throw new InvalidInputException(this.bind("unit.more", this.filenames[i])); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("unit.more", this.filenames[i])); //$NON-NLS-1$ knownFileNames.put(charName, charName); File file = new File(this.filenames[i]); if (!file.exists()) - throw new InvalidInputException(this.bind("unit.missing", this.filenames[i])); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("unit.missing", this.filenames[i])); //$NON-NLS-1$ String encoding = this.encodings[i]; if (encoding == null) encoding = defaultEncoding; @@ -2791,7 +2789,7 @@ /* * External API */ -protected ArrayList handleBootclasspath(ArrayList bootclasspaths, String customEncoding) throws InvalidInputException { +protected ArrayList handleBootclasspath(ArrayList bootclasspaths, String customEncoding) { final int bootclasspathsSize = bootclasspaths == null ? 0 : bootclasspaths.size(); if (bootclasspathsSize != 0) { String[] paths = new String[bootclasspathsSize]; @@ -2878,7 +2876,7 @@ /* * External API */ -protected ArrayList handleClasspath(ArrayList classpaths, String customEncoding) throws InvalidInputException { +protected ArrayList handleClasspath(ArrayList classpaths, String customEncoding) { final int classpathsSize = classpaths == null ? 0 : classpaths.size(); if (classpathsSize != 0) { String[] paths = new String[classpathsSize]; @@ -3063,7 +3061,7 @@ * External API * Handle a single warning token. */ -protected void handleWarningToken(String token, boolean isEnabling) throws InvalidInputException { +protected void handleWarningToken(String token, boolean isEnabling) { if (token.length() == 0) return; switch(token.charAt(0)) { case 'a' : @@ -3399,7 +3397,7 @@ taskTags = taskTags.replace('|',','); } if (taskTags.length() == 0){ - throw new InvalidInputException(this.bind("configure.invalidTaskTag", token)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.invalidTaskTag", token)); //$NON-NLS-1$ } this.options.put( CompilerOptions.OPTION_TaskTags, @@ -3634,7 +3632,7 @@ /* * Low-level API performing the actual compilation */ -public void performCompilation() throws InvalidInputException { +public void performCompilation() { this.startTime = System.currentTimeMillis(); @@ -3706,7 +3704,7 @@ })); this.logger.flush(); } -private ReferenceBinding[] processClassNames(LookupEnvironment environment) throws InvalidInputException { +private ReferenceBinding[] processClassNames(LookupEnvironment environment) { // check for .class file presence in case of apt processing int length = this.classNames.length; ReferenceBinding[] referenceBindings = new ReferenceBinding[length]; @@ -3726,7 +3724,7 @@ referenceBindings[i] = type; } } else { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.invalidClassName", currentName));//$NON-NLS-1$ } } @@ -3737,8 +3735,7 @@ */ public void processPathEntries(final int defaultSize, final ArrayList paths, final String currentPath, String customEncoding, boolean isSourceOnly, - boolean rejectDestinationPathOnJars) - throws InvalidInputException { + boolean rejectDestinationPathOnJars) { String currentClasspathName = null; String currentDestinationPath = null; ArrayList currentRuleSpecs = new ArrayList(defaultSize); @@ -3798,7 +3795,7 @@ state = rulesNeedAnotherRule; break; case destinationPathReadyToClose: - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ currentPath)); case bracketClosed: @@ -3855,7 +3852,7 @@ case rulesStart: if (token.startsWith("-d ")) { //$NON-NLS-1$ if (currentDestinationPath != null) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.duplicateDestinationPathEntry", //$NON-NLS-1$ currentPath)); } @@ -3866,7 +3863,7 @@ //$FALL-THROUGH$ case rulesNeedAnotherRule: if (currentDestinationPath != null) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.accessRuleAfterDestinationPath", //$NON-NLS-1$ currentPath)); } @@ -3918,7 +3915,7 @@ } } -private int processPaths(String[] args, int index, String currentArg, ArrayList paths) throws InvalidInputException { +private int processPaths(String[] args, int index, String currentArg, ArrayList paths) { int localIndex = index; int count = 0; for (int i = 0, max = currentArg.length(); i < max; i++) { @@ -3934,14 +3931,14 @@ if (count == 0) { paths.add(currentArg); } else if (count > 1) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedBracket", //$NON-NLS-1$ currentArg)); } else { StringBuffer currentPath = new StringBuffer(currentArg); while (true) { if (localIndex >= args.length) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedBracket", //$NON-NLS-1$ currentArg)); } @@ -3951,7 +3948,7 @@ switch(nextArg.charAt(i)) { case '[' : if (count > 1) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedBracket", //$NON-NLS-1$ nextArg)); } @@ -3968,7 +3965,7 @@ paths.add(currentPath.toString()); return localIndex - index; } else if (count < 0) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedBracket", //$NON-NLS-1$ nextArg)); } else { @@ -3980,7 +3977,7 @@ } return localIndex - index; } -private int processPaths(String[] args, int index, String currentArg, String[] paths) throws InvalidInputException { +private int processPaths(String[] args, int index, String currentArg, String[] paths) { int localIndex = index; int count = 0; for (int i = 0, max = currentArg.length(); i < max; i++) { @@ -4000,7 +3997,7 @@ while (true) { localIndex++; if (localIndex >= args.length) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedBracket", //$NON-NLS-1$ currentArg)); } @@ -4009,7 +4006,7 @@ switch(nextArg.charAt(i)) { case '[' : if (count > 1) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedBracket", //$NON-NLS-1$ currentArg)); } @@ -4026,7 +4023,7 @@ paths[0] = currentPath.toString(); return localIndex - index; } else if (count < 0) { - throw new InvalidInputException( + throw new IllegalArgumentException( this.bind("configure.unexpectedBracket", //$NON-NLS-1$ currentArg)); } else { @@ -4075,7 +4072,7 @@ ArrayList classpaths, ArrayList extdirsClasspaths, ArrayList endorsedDirClasspaths, - String customEncoding) throws InvalidInputException { + String customEncoding) { // process bootclasspath, classpath and sourcepaths bootclasspaths = handleBootclasspath(bootclasspaths, customEncoding); @@ -4115,7 +4112,7 @@ classpaths.toArray(this.checkedClasspaths); this.logger.logClasspath(this.checkedClasspaths); } -protected void validateOptions(boolean didSpecifyCompliance) throws InvalidInputException { +protected void validateOptions(boolean didSpecifyCompliance) { if (didSpecifyCompliance) { Object version = this.options.get(CompilerOptions.OPTION_Compliance); if (CompilerOptions.VERSION_1_3.equals(version)) { @@ -4200,19 +4197,19 @@ if (sourceVersion.equals(CompilerOptions.VERSION_1_7) && CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_7) { // compliance must be 1.7 if source is 1.7 - throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_7)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_7)); //$NON-NLS-1$ } else if (sourceVersion.equals(CompilerOptions.VERSION_1_6) && CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_6) { // compliance must be 1.6 if source is 1.6 - throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_6)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_6)); //$NON-NLS-1$ } else if (sourceVersion.equals(CompilerOptions.VERSION_1_5) && CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_5) { // compliance must be 1.5 if source is 1.5 - throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$ } else if (sourceVersion.equals(CompilerOptions.VERSION_1_4) && CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_4) { // compliance must be 1.4 if source is 1.4 - throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_4)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_4)); //$NON-NLS-1$ } // check and set compliance/source/target compatibilities @@ -4222,39 +4219,39 @@ if (CompilerOptions.VERSION_JSR14.equals(targetVersion)) { // expecting source >= 1.5 if (CompilerOptions.versionToJdkLevel(sourceVersion) < ClassFileConstants.JDK1_5) { - throw new InvalidInputException(this.bind("configure.incompatibleTargetForGenericSource", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForGenericSource", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$ } } else if (CompilerOptions.VERSION_CLDC1_1.equals(targetVersion)) { if (this.didSpecifySource && CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_4) { - throw new InvalidInputException(this.bind("configure.incompatibleSourceForCldcTarget", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.incompatibleSourceForCldcTarget", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$ } if (CompilerOptions.versionToJdkLevel(compliance) >= ClassFileConstants.JDK1_5) { - throw new InvalidInputException(this.bind("configure.incompatibleComplianceForCldcTarget", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForCldcTarget", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$ } } else { // target must be 1.7 if source is 1.7 if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_7 && CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_7){ - throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_7)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_7)); //$NON-NLS-1$ } // target must be 1.6 if source is 1.6 if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_6 && CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_6){ - throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_6)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_6)); //$NON-NLS-1$ } // target must be 1.5 if source is 1.5 if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_5 && CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_5){ - throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_5)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_5)); //$NON-NLS-1$ } // target must be 1.4 if source is 1.4 if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_4 && CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_4){ - throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_4)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_4)); //$NON-NLS-1$ } // target cannot be greater than compliance level if (CompilerOptions.versionToJdkLevel(compliance) < CompilerOptions.versionToJdkLevel(targetVersion)){ - throw new InvalidInputException(this.bind("configure.incompatibleComplianceForTarget", (String)this.options.get(CompilerOptions.OPTION_Compliance), (String) targetVersion)); //$NON-NLS-1$ + throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForTarget", (String)this.options.get(CompilerOptions.OPTION_Compliance), (String) targetVersion)); //$NON-NLS-1$ } } } #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/util/Util.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java,v retrieving revision 1.74 diff -u -r1.74 Util.java --- src/org/eclipse/jdt/core/tests/util/Util.java 23 Oct 2008 13:56:34 -0000 1.74 +++ src/org/eclipse/jdt/core/tests/util/Util.java 20 Nov 2008 15:43:08 -0000 @@ -1284,7 +1284,9 @@ throw new IOException("Could not delete " + zipPath); // ensure the new zip file has a different timestamp than the previous one int timeToWait = 1000; // some platform (like Linux) have a 1s granularity) - waitAtLeast(timeToWait); + waitAtLeast(timeToWait); + } else { + zipFile.getParentFile().mkdirs(); } zip = new ZipOutputStream(new FileOutputStream(zipFile)); zip(rootDir, zip, rootDir.getPath().length()+1); // 1 for last slash Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v retrieving revision 1.179 diff -u -r1.179 BatchCompilerTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 10 Nov 2008 17:39:34 -0000 1.179 +++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 20 Nov 2008 15:43:08 -0000 @@ -29,7 +29,6 @@ import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.compiler.CompilationProgress; -import org.eclipse.jdt.core.compiler.InvalidInputException; import org.eclipse.jdt.core.compiler.batch.BatchCompiler; import org.eclipse.jdt.core.tests.util.Util; import org.eclipse.jdt.internal.compiler.batch.ClasspathJar; @@ -756,7 +755,7 @@ try { (new Main(new PrintWriter(System.out), new PrintWriter(System.err), true/*systemExit*/, null/*options*/, null/*progress*/)). processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, classpathInput, null /* customEncoding */, true /* isSourceOnly */, false /* rejectDestinationPathOnJars*/); - } catch (InvalidInputException e) { + } catch (IllegalArgumentException e) { // e.printStackTrace(); if (expectedError == null) { fail("unexpected invalid input exception: " + e.getMessage()); @@ -2418,7 +2417,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88364 - cumulative -extdirs extends the classpath public void test025(){ - String path = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString(); + String path = org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.LIB_DIR; String libPath = null; if (path.endsWith(File.separator)) { libPath = path + "lib.jar"; @@ -2437,7 +2436,8 @@ JavaCore.VERSION_1_4); jarCreated = true; } catch (IOException e) { - // ignore + e.printStackTrace(); + assertTrue("Should not happen", false); } String setting= System.getProperty("jdt.compiler.useSingleThread"); try {