### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: batch/org/eclipse/jdt/internal/compiler/batch/messages.properties =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties,v retrieving revision 1.524 diff -u -r1.524 messages.properties --- batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 14 Apr 2006 08:42:26 -0000 1.524 +++ batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 17 Apr 2006 19:30:42 -0000 @@ -49,7 +49,7 @@ configure.source = source level should be comprised in between ''1.3'' and ''1.6'' (or ''6'' or ''6.0''): {0} configure.duplicateOutputPath = duplicate output path specification: {0} configure.duplicateBootClasspath = duplicate bootclasspath specification: {0} -configure.duplicateExtdirs = duplicate extdirs specification: {0} +configure.duplicateExtDirs = duplicate extdirs specification: {0} configure.duplicateSourcepath = duplicate sourcepath specification: {0} configure.invalidDebugOption = invalid debug option: {0} configure.invalidWarningConfiguration = invalid warning configuration: {0} @@ -72,6 +72,8 @@ configure.duplicateDefaultEncoding = duplicate default encoding format specification: {0} configure.invalidTaskTag ={0} is an invalid task tag configure.incorrectExtDirsEntry = incorrect ext dir entry; {0} must be a directory +configure.incorrectEndorsedDirsEntry = incorrect endorsed dir entry; {0} must be a directory +configure.duplicateEndorsedDirs = duplicate endorseddirs specification: {0} ### requestor requestor.error = {0}. ERROR in {1} @@ -114,6 +116,8 @@ \ user.dir folder in case no destination directory is specified.\n\ \ -extdirs \n\ \ specify location for extension zip/jar files\n\ +\ -endorseddirs \n\ +\ specify location for extension zip/jar files\n\ \ -d destination directory (if omitted, no directory is created)\n\ \ -d none generate no .class files\n\ \ -encoding specify custom encoding for all sources. Each file/directory can override it\n\ 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.246 diff -u -r1.246 Main.java --- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 12 Apr 2006 15:31:24 -0000 1.246 +++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 17 Apr 2006 19:30:42 -0000 @@ -451,6 +451,20 @@ this.printlnErr(Main.bind( "configure.incorrectExtDirsEntry", wrongPath)); //$NON-NLS-1$ } + + /** + * @param wrongPath + * the given wrong path entry + */ + public void logIncorrectEndorsedDirsEntry(String wrongPath) { + if ((this.tagBits & Logger.XML) != 0) { + this.parameters.clear(); + this.parameters.put(Logger.MESSAGE, Main.bind("configure.incorrectEndorsedDirsEntry", wrongPath)); //$NON-NLS-1$ + this.printTag(Logger.ERROR_TAG, this.parameters, true, true); + } + this.printlnErr(Main.bind( + "configure.incorrectEndorsedDirsEntry", wrongPath)); //$NON-NLS-1$ + } /** * @@ -1356,14 +1370,15 @@ final int INSIDE_MAX_PROBLEMS = 9; final int INSIDE_EXT_DIRS = 10; final int INSIDE_SOURCE_PATH = 11; + final int INSIDE_ENDORSED_DIRS = 12; final int DEFAULT = 0; final int DEFAULT_SIZE_CLASSPATH = 4; - ArrayList bootclasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH), - extdirsClasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH), - extdirsNames = new ArrayList(DEFAULT_SIZE_CLASSPATH), - sourcepathClasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH), - classpaths = new ArrayList(DEFAULT_SIZE_CLASSPATH); + ArrayList bootclasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH); + ArrayList sourcepathClasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH); + ArrayList classpaths = new ArrayList(DEFAULT_SIZE_CLASSPATH); + ArrayList extdirsClasspaths = null; + ArrayList endorsedDirClasspath = null; int index = -1, filesCount = 0, argCount = argv.length; int mode = DEFAULT; @@ -1605,7 +1620,7 @@ continue; } if (currentArg.equals("-extdirs")) {//$NON-NLS-1$ - if (extdirsNames.size() > 0) { + if (extdirsClasspaths != null) { StringBuffer errorMessage = new StringBuffer(); errorMessage.append(currentArg); if ((index + 1) < argCount) { @@ -1613,11 +1628,25 @@ errorMessage.append(newCommandLineArgs[index + 1]); } throw new InvalidInputException( - Main.bind("configure.duplicateExtdirs", errorMessage.toString())); //$NON-NLS-1$ + Main.bind("configure.duplicateExtDirs", errorMessage.toString())); //$NON-NLS-1$ } mode = INSIDE_EXT_DIRS; continue; } + if (currentArg.equals("-endorseddirs")) { //$NON-NLS-1$ + if (endorsedDirClasspath != null) { + StringBuffer errorMessage = new StringBuffer(); + errorMessage.append(currentArg); + if ((index + 1) < argCount) { + errorMessage.append(' '); + errorMessage.append(newCommandLineArgs[index + 1]); + } + throw new InvalidInputException( + Main.bind("configure.duplicateEndorsedDirs", errorMessage.toString())); //$NON-NLS-1$ + } + mode = INSIDE_ENDORSED_DIRS; + continue; + } if (currentArg.equals("-progress")) { //$NON-NLS-1$ mode = DEFAULT; this.showProgress = true; @@ -2142,21 +2171,6 @@ mode = DEFAULT; continue; } - - if (currentArg.equals("-sourcepath")) {//$NON-NLS-1$ - if (sourcepathClasspaths.size() > 0) - throw new InvalidInputException( - Main.bind("configure.duplicateSourcepath", currentArg)); //$NON-NLS-1$ - mode = INSIDE_SOURCE_PATH; - continue; - } - if (currentArg.equals("-extdirs")) {//$NON-NLS-1$ - if (extdirsNames.size() > 0) - throw new InvalidInputException( - Main.bind("configure.duplicateExtdirs", currentArg)); //$NON-NLS-1$ - mode = INSIDE_EXT_DIRS; - continue; - } break; case INSIDE_TARGET : if (this.didSpecifyTarget) { @@ -2260,10 +2274,16 @@ continue; case INSIDE_EXT_DIRS : StringTokenizer tokenizer = new StringTokenizer(currentArg, File.pathSeparator, false); + extdirsClasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH); + while (tokenizer.hasMoreTokens()) + extdirsClasspaths.add(tokenizer.nextToken()); + mode = DEFAULT; + continue; + case INSIDE_ENDORSED_DIRS : + tokenizer = new StringTokenizer(currentArg, File.pathSeparator, false); + endorsedDirClasspath = new ArrayList(DEFAULT_SIZE_CLASSPATH); while (tokenizer.hasMoreTokens()) - extdirsNames.add(tokenizer.nextToken()); - if (extdirsNames.size() == 0) // empty entry - extdirsNames.add(""); //$NON-NLS-1$ + endorsedDirClasspath.add(tokenizer.nextToken()); mode = DEFAULT; continue; } @@ -2435,19 +2455,20 @@ filesCount); /* - * Feed extdirsNames according to: + * Feed endorsedDirClasspath according to: * - -extdirs first if present; * - else java.ext.dirs if defined; * - else default extensions directory for the platform. */ - if (extdirsNames.size() == 0) { + if (extdirsClasspaths == null) { + extdirsClasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH); String extdirsStr = System.getProperty("java.ext.dirs"); //$NON-NLS-1$ if (extdirsStr == null) { - extdirsNames.add(javaHome.getAbsolutePath() + "/lib/ext"); //$NON-NLS-1$ + extdirsClasspaths.add(javaHome.getAbsolutePath() + "/lib/ext"); //$NON-NLS-1$ } else { StringTokenizer tokenizer = new StringTokenizer(extdirsStr, File.pathSeparator); while (tokenizer.hasMoreTokens()) - extdirsNames.add(tokenizer.nextToken()); + extdirsClasspaths.add(tokenizer.nextToken()); } } @@ -2455,10 +2476,11 @@ * Feed extdirsClasspath with the entries found into the directories listed by * extdirsNames. */ - if (extdirsNames.size() != 0) { - File[] directoriesToCheck = new File[extdirsNames.size()]; + if (extdirsClasspaths.size() != 0) { + File[] directoriesToCheck = new File[extdirsClasspaths.size()]; for (int i = 0; i < directoriesToCheck.length; i++) - directoriesToCheck[i] = new File((String) extdirsNames.get(i)); + directoriesToCheck[i] = new File((String) extdirsClasspaths.get(i)); + extdirsClasspaths.clear(); File[][] extdirsJars = getLibrariesFiles(directoriesToCheck); if (extdirsJars != null) { for (int i = 0, max = extdirsJars.length; i < max; i++) { @@ -2480,6 +2502,54 @@ } } + /* + * Feed endorsedDirClasspath according to: + * - -endorseddirs first if present; + * - else java.endorsed.dirs if defined; + * - else default extensions directory for the platform. (/lib/endorsed) + */ + if (endorsedDirClasspath == null) { + endorsedDirClasspath = new ArrayList(DEFAULT_SIZE_CLASSPATH); + String endorsedDirsStr = System.getProperty("java.endorsed.dirs"); //$NON-NLS-1$ + if (endorsedDirsStr == null) { + extdirsClasspaths.add(javaHome.getAbsolutePath() + "/lib/endorsed"); //$NON-NLS-1$ + } else { + StringTokenizer tokenizer = new StringTokenizer(endorsedDirsStr, File.pathSeparator); + while (tokenizer.hasMoreTokens()) + endorsedDirClasspath.add(tokenizer.nextToken()); + } + } + + /* + * Feed extdirsClasspath with the entries found into the directories listed by + * extdirsNames. + */ + if (endorsedDirClasspath.size() != 0) { + File[] directoriesToCheck = new File[endorsedDirClasspath.size()]; + for (int i = 0; i < directoriesToCheck.length; i++) + directoriesToCheck[i] = new File((String) endorsedDirClasspath.get(i)); + endorsedDirClasspath.clear(); + File[][] endorsedDirsJars = getLibrariesFiles(directoriesToCheck); + if (endorsedDirsJars != null) { + for (int i = 0, max = endorsedDirsJars.length; i < max; i++) { + File[] current = endorsedDirsJars[i]; + if (current != null) { + for (int j = 0, max2 = current.length; j < max2; j++) { + FileSystem.Classpath classpath = + FileSystem.getClasspath( + current[j].getAbsolutePath(), + null, null); + if (classpath != null) { + endorsedDirClasspath.add(classpath); + } + } + } else if (directoriesToCheck[i].isFile()) { + this.logger.logIncorrectEndorsedDirsEntry(directoriesToCheck[i].getAbsolutePath()); + } + } + } + } + /* * Concatenate classpath entries * We put the bootclasspath at the beginning of the classpath @@ -2488,12 +2558,14 @@ * entries are searched for both sources and binaries except * the sourcepath entries which are searched for sources only. */ + bootclasspaths.addAll(endorsedDirClasspath); bootclasspaths.addAll(extdirsClasspaths); bootclasspaths.addAll(sourcepathClasspaths); bootclasspaths.addAll(classpaths); classpaths = bootclasspaths; this.checkedClasspaths = new FileSystem.Classpath[classpaths.size()]; classpaths.toArray(this.checkedClasspaths); + if (this.destinationPath == null) { this.generatePackagesStructure = false; } else if ("none".equals(this.destinationPath)) { //$NON-NLS-1$