View | Details | Raw Unified | Return to bug 126419 | Differences between
and this patch

Collapse All | Expand All

(-)batch/org/eclipse/jdt/internal/compiler/batch/messages.properties (-1 / +5 lines)
Lines 49-55 Link Here
49
configure.source = source level should be comprised in between ''1.3'' and ''1.6'' (or ''6'' or ''6.0''): {0}
49
configure.source = source level should be comprised in between ''1.3'' and ''1.6'' (or ''6'' or ''6.0''): {0}
50
configure.duplicateOutputPath = duplicate output path specification: {0}
50
configure.duplicateOutputPath = duplicate output path specification: {0}
51
configure.duplicateBootClasspath = duplicate bootclasspath specification: {0}
51
configure.duplicateBootClasspath = duplicate bootclasspath specification: {0}
52
configure.duplicateExtdirs = duplicate extdirs specification: {0}
52
configure.duplicateExtDirs = duplicate extdirs specification: {0}
53
configure.duplicateSourcepath = duplicate sourcepath specification: {0}
53
configure.duplicateSourcepath = duplicate sourcepath specification: {0}
54
configure.invalidDebugOption = invalid debug option: {0}
54
configure.invalidDebugOption = invalid debug option: {0}
55
configure.invalidWarningConfiguration = invalid warning configuration: {0}
55
configure.invalidWarningConfiguration = invalid warning configuration: {0}
Lines 72-77 Link Here
72
configure.duplicateDefaultEncoding = duplicate default encoding format specification: {0}
72
configure.duplicateDefaultEncoding = duplicate default encoding format specification: {0}
73
configure.invalidTaskTag ={0} is an invalid task tag
73
configure.invalidTaskTag ={0} is an invalid task tag
74
configure.incorrectExtDirsEntry = incorrect ext dir entry; {0} must be a directory
74
configure.incorrectExtDirsEntry = incorrect ext dir entry; {0} must be a directory
75
configure.incorrectEndorsedDirsEntry = incorrect endorsed dir entry; {0} must be a directory
76
configure.duplicateEndorsedDirs = duplicate endorseddirs specification: {0}
75
77
76
### requestor
78
### requestor
77
requestor.error = {0}. ERROR in {1}
79
requestor.error = {0}. ERROR in {1}
Lines 114-119 Link Here
114
\                       user.dir folder in case no destination directory is specified.\n\
116
\                       user.dir folder in case no destination directory is specified.\n\
115
\    -extdirs <directories separated by {0}>\n\
117
\    -extdirs <directories separated by {0}>\n\
116
\                       specify location for extension zip/jar files\n\
118
\                       specify location for extension zip/jar files\n\
119
\    -endorseddirs <directories separated by {0}>\n\
120
\                       specify location for extension zip/jar files\n\
117
\    -d <dir>           destination directory (if omitted, no directory is created)\n\
121
\    -d <dir>           destination directory (if omitted, no directory is created)\n\
118
\    -d none            generate no .class files\n\
122
\    -d none            generate no .class files\n\
119
\    -encoding <enc>    specify custom encoding for all sources. Each file/directory can override it\n\
123
\    -encoding <enc>    specify custom encoding for all sources. Each file/directory can override it\n\
(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-32 / +104 lines)
Lines 451-456 Link Here
451
			this.printlnErr(Main.bind(
451
			this.printlnErr(Main.bind(
452
				"configure.incorrectExtDirsEntry", wrongPath)); //$NON-NLS-1$
452
				"configure.incorrectExtDirsEntry", wrongPath)); //$NON-NLS-1$
453
		}
453
		}
454
		
455
		/**
456
		 * @param wrongPath
457
		 *            the given wrong path entry
458
		 */
459
		public void logIncorrectEndorsedDirsEntry(String wrongPath) {
460
			if ((this.tagBits & Logger.XML) != 0) {
461
				this.parameters.clear();
462
				this.parameters.put(Logger.MESSAGE, Main.bind("configure.incorrectEndorsedDirsEntry", wrongPath)); //$NON-NLS-1$
463
				this.printTag(Logger.ERROR_TAG, this.parameters, true, true);
464
			}
465
			this.printlnErr(Main.bind(
466
				"configure.incorrectEndorsedDirsEntry", wrongPath)); //$NON-NLS-1$
467
		}
454
468
455
		/**
469
		/**
456
		 * 
470
		 * 
Lines 1356-1369 Link Here
1356
	final int INSIDE_MAX_PROBLEMS = 9;
1370
	final int INSIDE_MAX_PROBLEMS = 9;
1357
	final int INSIDE_EXT_DIRS = 10;
1371
	final int INSIDE_EXT_DIRS = 10;
1358
	final int INSIDE_SOURCE_PATH = 11;
1372
	final int INSIDE_SOURCE_PATH = 11;
1373
	final int INSIDE_ENDORSED_DIRS = 12;
1359
1374
1360
	final int DEFAULT = 0;
1375
	final int DEFAULT = 0;
1361
	final int DEFAULT_SIZE_CLASSPATH = 4;
1376
	final int DEFAULT_SIZE_CLASSPATH = 4;
1362
	ArrayList bootclasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH),
1377
	ArrayList bootclasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH);
1363
		extdirsClasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH),
1378
	ArrayList sourcepathClasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH);
1364
		extdirsNames = new ArrayList(DEFAULT_SIZE_CLASSPATH),
1379
	ArrayList classpaths = new ArrayList(DEFAULT_SIZE_CLASSPATH);
1365
		sourcepathClasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH),
1380
	ArrayList extdirsClasspaths = null;
1366
		classpaths = new ArrayList(DEFAULT_SIZE_CLASSPATH);
1381
	ArrayList endorsedDirClasspath = null;
1367
	
1382
	
1368
	int index = -1, filesCount = 0, argCount = argv.length;
1383
	int index = -1, filesCount = 0, argCount = argv.length;
1369
	int mode = DEFAULT;
1384
	int mode = DEFAULT;
Lines 1605-1611 Link Here
1605
					continue;
1620
					continue;
1606
				}
1621
				}
1607
				if (currentArg.equals("-extdirs")) {//$NON-NLS-1$
1622
				if (currentArg.equals("-extdirs")) {//$NON-NLS-1$
1608
					if (extdirsNames.size() > 0) {
1623
					if (extdirsClasspaths != null) {
1609
						StringBuffer errorMessage = new StringBuffer();
1624
						StringBuffer errorMessage = new StringBuffer();
1610
						errorMessage.append(currentArg);
1625
						errorMessage.append(currentArg);
1611
						if ((index + 1) < argCount) {
1626
						if ((index + 1) < argCount) {
Lines 1613-1623 Link Here
1613
							errorMessage.append(newCommandLineArgs[index + 1]);
1628
							errorMessage.append(newCommandLineArgs[index + 1]);
1614
						}
1629
						}
1615
						throw new InvalidInputException(
1630
						throw new InvalidInputException(
1616
							Main.bind("configure.duplicateExtdirs", errorMessage.toString())); //$NON-NLS-1$
1631
							Main.bind("configure.duplicateExtDirs", errorMessage.toString())); //$NON-NLS-1$
1617
					}
1632
					}
1618
					mode = INSIDE_EXT_DIRS;
1633
					mode = INSIDE_EXT_DIRS;
1619
					continue;
1634
					continue;
1620
				}
1635
				}
1636
				if (currentArg.equals("-endorseddirs")) { //$NON-NLS-1$
1637
					if (endorsedDirClasspath != null) {
1638
						StringBuffer errorMessage = new StringBuffer();
1639
						errorMessage.append(currentArg);
1640
						if ((index + 1) < argCount) {
1641
							errorMessage.append(' ');
1642
							errorMessage.append(newCommandLineArgs[index + 1]);
1643
						}
1644
						throw new InvalidInputException(
1645
							Main.bind("configure.duplicateEndorsedDirs", errorMessage.toString())); //$NON-NLS-1$
1646
					}
1647
					mode = INSIDE_ENDORSED_DIRS;
1648
					continue;
1649
				}
1621
				if (currentArg.equals("-progress")) { //$NON-NLS-1$
1650
				if (currentArg.equals("-progress")) { //$NON-NLS-1$
1622
					mode = DEFAULT;
1651
					mode = DEFAULT;
1623
					this.showProgress = true;
1652
					this.showProgress = true;
Lines 2142-2162 Link Here
2142
					mode = DEFAULT;
2171
					mode = DEFAULT;
2143
					continue;
2172
					continue;
2144
				}
2173
				}
2145
				
2146
				if (currentArg.equals("-sourcepath")) {//$NON-NLS-1$
2147
					if (sourcepathClasspaths.size() > 0)
2148
						throw new InvalidInputException(
2149
							Main.bind("configure.duplicateSourcepath", currentArg)); //$NON-NLS-1$
2150
					mode = INSIDE_SOURCE_PATH;
2151
					continue;
2152
				}
2153
				if (currentArg.equals("-extdirs")) {//$NON-NLS-1$
2154
					if (extdirsNames.size() > 0)
2155
						throw new InvalidInputException(
2156
							Main.bind("configure.duplicateExtdirs", currentArg)); //$NON-NLS-1$
2157
					mode = INSIDE_EXT_DIRS;
2158
					continue;
2159
				}
2160
				break;
2174
				break;
2161
			case INSIDE_TARGET :
2175
			case INSIDE_TARGET :
2162
				if (this.didSpecifyTarget) {
2176
				if (this.didSpecifyTarget) {
Lines 2260-2269 Link Here
2260
				continue;
2274
				continue;
2261
			case INSIDE_EXT_DIRS :
2275
			case INSIDE_EXT_DIRS :
2262
				StringTokenizer tokenizer = new StringTokenizer(currentArg,	File.pathSeparator, false);
2276
				StringTokenizer tokenizer = new StringTokenizer(currentArg,	File.pathSeparator, false);
2277
				extdirsClasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH);
2278
				while (tokenizer.hasMoreTokens())
2279
					extdirsClasspaths.add(tokenizer.nextToken());
2280
				mode = DEFAULT;
2281
				continue;
2282
			case INSIDE_ENDORSED_DIRS :
2283
				tokenizer = new StringTokenizer(currentArg,	File.pathSeparator, false);
2284
				endorsedDirClasspath = new ArrayList(DEFAULT_SIZE_CLASSPATH);
2263
				while (tokenizer.hasMoreTokens())
2285
				while (tokenizer.hasMoreTokens())
2264
					extdirsNames.add(tokenizer.nextToken());
2286
					endorsedDirClasspath.add(tokenizer.nextToken());
2265
				if (extdirsNames.size() == 0) // empty entry
2266
					extdirsNames.add(""); //$NON-NLS-1$
2267
				mode = DEFAULT;
2287
				mode = DEFAULT;
2268
				continue;
2288
				continue;
2269
		}
2289
		}
Lines 2435-2453 Link Here
2435
			filesCount);
2455
			filesCount);
2436
2456
2437
	/*
2457
	/*
2438
	 * Feed extdirsNames according to:
2458
	 * Feed endorsedDirClasspath according to:
2439
	 * - -extdirs first if present;
2459
	 * - -extdirs first if present;
2440
	 * - else java.ext.dirs if defined;
2460
	 * - else java.ext.dirs if defined;
2441
	 * - else default extensions directory for the platform.
2461
	 * - else default extensions directory for the platform.
2442
	 */
2462
	 */
2443
	if (extdirsNames.size() == 0) {
2463
	if (extdirsClasspaths == null) {
2464
		extdirsClasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH);
2444
		String extdirsStr = System.getProperty("java.ext.dirs"); //$NON-NLS-1$
2465
		String extdirsStr = System.getProperty("java.ext.dirs"); //$NON-NLS-1$
2445
		if (extdirsStr == null) {
2466
		if (extdirsStr == null) {
2446
			extdirsNames.add(javaHome.getAbsolutePath() + "/lib/ext"); //$NON-NLS-1$
2467
			extdirsClasspaths.add(javaHome.getAbsolutePath() + "/lib/ext"); //$NON-NLS-1$
2447
		} else {
2468
		} else {
2448
			StringTokenizer tokenizer = new StringTokenizer(extdirsStr, File.pathSeparator);
2469
			StringTokenizer tokenizer = new StringTokenizer(extdirsStr, File.pathSeparator);
2449
			while (tokenizer.hasMoreTokens()) 
2470
			while (tokenizer.hasMoreTokens()) 
2450
				extdirsNames.add(tokenizer.nextToken());
2471
				extdirsClasspaths.add(tokenizer.nextToken());
2451
		}
2472
		}
2452
	}
2473
	}
2453
	
2474
	
Lines 2455-2464 Link Here
2455
	 * Feed extdirsClasspath with the entries found into the directories listed by
2476
	 * Feed extdirsClasspath with the entries found into the directories listed by
2456
	 * extdirsNames.
2477
	 * extdirsNames.
2457
	 */
2478
	 */
2458
	if (extdirsNames.size() != 0) {
2479
	if (extdirsClasspaths.size() != 0) {
2459
		File[] directoriesToCheck = new File[extdirsNames.size()];
2480
		File[] directoriesToCheck = new File[extdirsClasspaths.size()];
2460
		for (int i = 0; i < directoriesToCheck.length; i++) 
2481
		for (int i = 0; i < directoriesToCheck.length; i++) 
2461
			directoriesToCheck[i] = new File((String) extdirsNames.get(i));
2482
			directoriesToCheck[i] = new File((String) extdirsClasspaths.get(i));
2483
		extdirsClasspaths.clear();
2462
		File[][] extdirsJars = getLibrariesFiles(directoriesToCheck);
2484
		File[][] extdirsJars = getLibrariesFiles(directoriesToCheck);
2463
		if (extdirsJars != null) {
2485
		if (extdirsJars != null) {
2464
			for (int i = 0, max = extdirsJars.length; i < max; i++) {
2486
			for (int i = 0, max = extdirsJars.length; i < max; i++) {
Lines 2480-2485 Link Here
2480
		}
2502
		}
2481
	}
2503
	}
2482
2504
2505
	/*
2506
	 * Feed endorsedDirClasspath according to:
2507
	 * - -endorseddirs first if present;
2508
	 * - else java.endorsed.dirs if defined;
2509
	 * - else default extensions directory for the platform. (/lib/endorsed)
2510
	 */
2511
	if (endorsedDirClasspath == null) {
2512
		endorsedDirClasspath = new ArrayList(DEFAULT_SIZE_CLASSPATH);
2513
		String endorsedDirsStr = System.getProperty("java.endorsed.dirs"); //$NON-NLS-1$
2514
		if (endorsedDirsStr == null) {
2515
			extdirsClasspaths.add(javaHome.getAbsolutePath() + "/lib/endorsed"); //$NON-NLS-1$
2516
		} else {
2517
			StringTokenizer tokenizer = new StringTokenizer(endorsedDirsStr, File.pathSeparator);
2518
			while (tokenizer.hasMoreTokens()) 
2519
				endorsedDirClasspath.add(tokenizer.nextToken());
2520
		}
2521
	}
2522
	
2523
	/*
2524
	 * Feed extdirsClasspath with the entries found into the directories listed by
2525
	 * extdirsNames.
2526
	 */
2527
	if (endorsedDirClasspath.size() != 0) {
2528
		File[] directoriesToCheck = new File[endorsedDirClasspath.size()];
2529
		for (int i = 0; i < directoriesToCheck.length; i++) 
2530
			directoriesToCheck[i] = new File((String) endorsedDirClasspath.get(i));
2531
		endorsedDirClasspath.clear();
2532
		File[][] endorsedDirsJars = getLibrariesFiles(directoriesToCheck);
2533
		if (endorsedDirsJars != null) {
2534
			for (int i = 0, max = endorsedDirsJars.length; i < max; i++) {
2535
				File[] current = endorsedDirsJars[i];
2536
				if (current != null) {
2537
					for (int j = 0, max2 = current.length; j < max2; j++) {
2538
						FileSystem.Classpath classpath = 
2539
							FileSystem.getClasspath(
2540
									current[j].getAbsolutePath(),
2541
									null, null); 
2542
						if (classpath != null) {
2543
							endorsedDirClasspath.add(classpath);
2544
						}
2545
					}
2546
				} else if (directoriesToCheck[i].isFile()) {
2547
					this.logger.logIncorrectEndorsedDirsEntry(directoriesToCheck[i].getAbsolutePath());
2548
				}
2549
			}
2550
		}
2551
	}
2552
	
2483
	/* 
2553
	/* 
2484
	 * Concatenate classpath entries
2554
	 * Concatenate classpath entries
2485
	 * We put the bootclasspath at the beginning of the classpath
2555
	 * We put the bootclasspath at the beginning of the classpath
Lines 2488-2499 Link Here
2488
	 * entries are searched for both sources and binaries except
2558
	 * entries are searched for both sources and binaries except
2489
	 * the sourcepath entries which are searched for sources only.
2559
	 * the sourcepath entries which are searched for sources only.
2490
	 */
2560
	 */
2561
	bootclasspaths.addAll(endorsedDirClasspath);
2491
	bootclasspaths.addAll(extdirsClasspaths);
2562
	bootclasspaths.addAll(extdirsClasspaths);
2492
	bootclasspaths.addAll(sourcepathClasspaths);
2563
	bootclasspaths.addAll(sourcepathClasspaths);
2493
	bootclasspaths.addAll(classpaths);
2564
	bootclasspaths.addAll(classpaths);
2494
	classpaths = bootclasspaths;
2565
	classpaths = bootclasspaths;
2495
	this.checkedClasspaths = new FileSystem.Classpath[classpaths.size()];
2566
	this.checkedClasspaths = new FileSystem.Classpath[classpaths.size()];
2496
	classpaths.toArray(this.checkedClasspaths);
2567
	classpaths.toArray(this.checkedClasspaths);
2568
2497
	if (this.destinationPath == null) {
2569
	if (this.destinationPath == null) {
2498
		this.generatePackagesStructure = false;
2570
		this.generatePackagesStructure = false;
2499
	} else if ("none".equals(this.destinationPath)) { //$NON-NLS-1$
2571
	} else if ("none".equals(this.destinationPath)) { //$NON-NLS-1$

Return to bug 126419