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

Collapse All | Expand All

(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-25 / +25 lines)
Lines 806-839 Link Here
806
		}
806
		}
807
		private void printErr(String s) {
807
		private void printErr(String s) {
808
			this.err.print(s);
808
			this.err.print(s);
809
			if (!this.isXml) {
809
			if (!this.isXml && this.log != null) {
810
				if (this.log != null) {
810
				this.log.print(s);
811
					this.log.print(s);
812
				}
813
			}
811
			}
814
		}
812
		}
815
813
816
		private void printlnErr(String s) {
814
		private void printlnErr(String s) {
817
			this.err.println(s);
815
			this.err.println(s);
818
			if (!this.isXml) {
816
			if (!this.isXml && this.log != null) {
819
				if (this.log != null) {
817
				this.log.println(s);
820
					this.log.println(s);
821
				}
822
			}
818
			}
823
		}
819
		}
824
820
825
		private void printlnOut(String s) {
821
		private void printlnOut(String s) {
826
			this.out.println(s);
822
			this.out.println(s);
827
			if (!this.isXml) {
823
			if (!this.isXml && this.log != null) {
828
				if (this.log != null) {
824
				this.log.println(s);
829
					this.log.println(s);
830
				}
831
			}
825
			}
832
		}
826
		}
833
827
834
		/**
835
		 * 
836
		 */
837
		public void printNewLine() {
828
		public void printNewLine() {
838
			this.out.println();
829
			this.out.println();
839
		}
830
		}
Lines 869-875 Link Here
869
			}
860
			}
870
		}
861
		}
871
862
872
		public void setLog(String logFileName) throws InvalidInputException {
863
		public void setLog(String logFileName, boolean printVersion) throws InvalidInputException {
873
			final Date date = new Date();
864
			final Date date = new Date();
874
			final SimpleDateFormat dateFormat = new SimpleDateFormat("d MMM yyyy HH:mm:ss", Locale.getDefault());//$NON-NLS-1$
865
			final SimpleDateFormat dateFormat = new SimpleDateFormat("d MMM yyyy HH:mm:ss", Locale.getDefault());//$NON-NLS-1$
875
			try {
866
			try {
Lines 890-898 Link Here
890
						this.printTag(COMPILER, parameters, true, false);
881
						this.printTag(COMPILER, parameters, true, false);
891
					} else {
882
					} else {
892
						this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$
883
						this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$
884
						if (printVersion) {
885
							this.logVersion();
886
						}
893
					}
887
					}
894
				} else {
888
				} else {
895
					this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$
889
					this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$
890
					if (printVersion) {
891
						this.logVersion();
892
					}
896
				}
893
				}
897
			} catch (FileNotFoundException e) {
894
			} catch (FileNotFoundException e) {
898
				throw new InvalidInputException(Main.bind("configure.cannotOpenLog")); //$NON-NLS-1$
895
				throw new InvalidInputException(Main.bind("configure.cannotOpenLog")); //$NON-NLS-1$
Lines 1221-1228 Link Here
1221
		int mode = Default;
1218
		int mode = Default;
1222
		this.repetitions = 0;
1219
		this.repetitions = 0;
1223
		boolean printUsageRequired = false;
1220
		boolean printUsageRequired = false;
1224
		boolean printVersionRequired = false;
1221
		this.printVersionRequired = false;
1225
		
1226
		boolean didSpecifySource = false;
1222
		boolean didSpecifySource = false;
1227
		boolean didSpecifyCompliance = false;
1223
		boolean didSpecifyCompliance = false;
1228
		boolean didSpecifyDefaultEncoding = false;
1224
		boolean didSpecifyDefaultEncoding = false;
Lines 1446-1457 Link Here
1446
			}
1442
			}
1447
			if (currentArg.equals("-version") //$NON-NLS-1$
1443
			if (currentArg.equals("-version") //$NON-NLS-1$
1448
					|| currentArg.equals("-v")) { //$NON-NLS-1$
1444
					|| currentArg.equals("-v")) { //$NON-NLS-1$
1445
				this.printVersionRequired = true;
1449
				printVersion();
1446
				printVersion();
1450
				this.proceed = false;
1447
				this.proceed = false;
1451
				return;
1448
				return;
1452
			}
1449
			}
1453
			if (currentArg.equals("-showversion")) { //$NON-NLS-1$
1450
			if (currentArg.equals("-showversion")) { //$NON-NLS-1$
1454
				printVersionRequired = true;
1451
				this.printVersionRequired = true;
1455
				continue;
1452
				continue;
1456
			}			
1453
			}			
1457
			if ("-deprecation".equals(currentArg)) { //$NON-NLS-1$
1454
			if ("-deprecation".equals(currentArg)) { //$NON-NLS-1$
Lines 2176-2182 Link Here
2176
		
2173
		
2177
2174
2178
		if (this.log != null) {
2175
		if (this.log != null) {
2179
			this.logger.setLog(this.log);
2176
			this.logger.setLog(this.log, this.printVersionRequired);
2177
			if (this.printVersionRequired) this.printVersionRequired = false;
2180
		} else {
2178
		} else {
2181
			this.showProgress = false;
2179
			this.showProgress = false;
2182
		}
2180
		}
Lines 2186-2194 Link Here
2186
			this.proceed = false;
2184
			this.proceed = false;
2187
			return;
2185
			return;
2188
		}
2186
		}
2189
		if (printVersionRequired) {
2187
2190
			printVersion();
2188
		printVersion();
2191
		}
2192
2189
2193
		if (filesCount != 0)
2190
		if (filesCount != 0)
2194
			System.arraycopy(
2191
			System.arraycopy(
Lines 2472-2477 Link Here
2472
2469
2473
	private File javaHomeCache;
2470
	private File javaHomeCache;
2474
	private boolean javaHomeChecked;
2471
	private boolean javaHomeChecked;
2472
	boolean printVersionRequired;
2475
	private File getJavaHome() {
2473
	private File getJavaHome() {
2476
		if (!javaHomeChecked) {
2474
		if (!javaHomeChecked) {
2477
			javaHomeChecked = true;
2475
			javaHomeChecked = true;
Lines 2717-2723 Link Here
2717
		this.logger.flush();
2715
		this.logger.flush();
2718
	}
2716
	}
2719
	public void printVersion() {
2717
	public void printVersion() {
2720
		this.logger.logVersion();
2718
		if (this.printVersionRequired) {
2721
		this.logger.flush();
2719
			this.logger.logVersion();
2720
			this.printVersionRequired = false;
2721
		}
2722
	}
2722
	}
2723
}
2723
}

Return to bug 107535