Index: batch/org/eclipse/jdt/internal/compiler/batch/Main.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java,v retrieving revision 1.204 diff -u -r1.204 Main.java --- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 10 Aug 2005 18:09:44 -0000 1.204 +++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 22 Aug 2005 15:24:09 -0000 @@ -806,34 +806,25 @@ } private void printErr(String s) { this.err.print(s); - if (!this.isXml) { - if (this.log != null) { - this.log.print(s); - } + if (!this.isXml && this.log != null) { + this.log.print(s); } } private void printlnErr(String s) { this.err.println(s); - if (!this.isXml) { - if (this.log != null) { - this.log.println(s); - } + if (!this.isXml && this.log != null) { + this.log.println(s); } } private void printlnOut(String s) { this.out.println(s); - if (!this.isXml) { - if (this.log != null) { - this.log.println(s); - } + if (!this.isXml && this.log != null) { + this.log.println(s); } } - /** - * - */ public void printNewLine() { this.out.println(); } @@ -869,7 +860,7 @@ } } - public void setLog(String logFileName) throws InvalidInputException { + public void setLog(String logFileName, boolean printVersion) throws InvalidInputException { final Date date = new Date(); final SimpleDateFormat dateFormat = new SimpleDateFormat("d MMM yyyy HH:mm:ss", Locale.getDefault());//$NON-NLS-1$ try { @@ -890,9 +881,15 @@ this.printTag(COMPILER, parameters, true, false); } else { this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$ + if (printVersion) { + this.logVersion(); + } } } else { this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$ + if (printVersion) { + this.logVersion(); + } } } catch (FileNotFoundException e) { throw new InvalidInputException(Main.bind("configure.cannotOpenLog")); //$NON-NLS-1$ @@ -1221,8 +1218,7 @@ int mode = Default; this.repetitions = 0; boolean printUsageRequired = false; - boolean printVersionRequired = false; - + this.printVersionRequired = false; boolean didSpecifySource = false; boolean didSpecifyCompliance = false; boolean didSpecifyDefaultEncoding = false; @@ -1446,12 +1442,13 @@ } if (currentArg.equals("-version") //$NON-NLS-1$ || currentArg.equals("-v")) { //$NON-NLS-1$ + this.printVersionRequired = true; printVersion(); this.proceed = false; return; } if (currentArg.equals("-showversion")) { //$NON-NLS-1$ - printVersionRequired = true; + this.printVersionRequired = true; continue; } if ("-deprecation".equals(currentArg)) { //$NON-NLS-1$ @@ -2176,7 +2173,8 @@ if (this.log != null) { - this.logger.setLog(this.log); + this.logger.setLog(this.log, this.printVersionRequired); + if (this.printVersionRequired) this.printVersionRequired = false; } else { this.showProgress = false; } @@ -2186,9 +2184,8 @@ this.proceed = false; return; } - if (printVersionRequired) { - printVersion(); - } + + printVersion(); if (filesCount != 0) System.arraycopy( @@ -2472,6 +2469,7 @@ private File javaHomeCache; private boolean javaHomeChecked; + boolean printVersionRequired; private File getJavaHome() { if (!javaHomeChecked) { javaHomeChecked = true; @@ -2717,7 +2715,9 @@ this.logger.flush(); } public void printVersion() { - this.logger.logVersion(); - this.logger.flush(); + if (this.printVersionRequired) { + this.logger.logVersion(); + this.printVersionRequired = false; + } } }