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

Collapse All | Expand All

(-)src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java (-4 / +12 lines)
Lines 6-12 Link Here
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 * Intel Corporation - Initial API and implementation
9
 *   Intel Corporation      - Initial API and implementation
10
 *   Siemens AG, Nils Hagge - Added using the different output, error, 
11
 *                            and info streams 
10
 *******************************************************************************/
12
 *******************************************************************************/
11
package org.eclipse.cdt.managedbuilder.internal.core;
13
package org.eclipse.cdt.managedbuilder.internal.core;
12
14
Lines 1829-1834 Link Here
1829
				IConsole console = bInfo.getConsole();
1831
				IConsole console = bInfo.getConsole();
1830
1832
1831
				OutputStream cos = console.getOutputStream();
1833
				OutputStream cos = console.getOutputStream();
1834
				OutputStream ces = console.getErrorStream(); // Nils
1835
				OutputStream cis = console.getInfoStream(); // Nils
1832
				StringBuffer buf = new StringBuffer();
1836
				StringBuffer buf = new StringBuffer();
1833
1837
1834
				String[] consoleHeader = new String[3];
1838
				String[] consoleHeader = new String[3];
Lines 1856-1863 Link Here
1856
					buf.append(System.getProperty("line.separator", "\n"));	//$NON-NLS-1$	//$NON-NLS-2$
1860
					buf.append(System.getProperty("line.separator", "\n"));	//$NON-NLS-1$	//$NON-NLS-2$
1857
					buf.append(System.getProperty("line.separator", "\n"));	//$NON-NLS-1$	//$NON-NLS-2$
1861
					buf.append(System.getProperty("line.separator", "\n"));	//$NON-NLS-1$	//$NON-NLS-2$
1858
				}
1862
				}
1859
				cos.write(buf.toString().getBytes());
1863
				cis.write(buf.toString().getBytes()); // Nils
1860
				cos.flush();
1864
				cis.flush(); // Nils
1861
1865
1862
				// remove all markers for this project
1866
				// remove all markers for this project
1863
				removeAllMarkers(currProject);
1867
				removeAllMarkers(currProject);
Lines 1902-1909 Link Here
1902
				StreamMonitor streamMon = new StreamMonitor(new SubProgressMonitor(monitor, 100), cos, last.intValue());
1906
				StreamMonitor streamMon = new StreamMonitor(new SubProgressMonitor(monitor, 100), cos, last.intValue());
1903
				ErrorParserManager epm = new ErrorParserManager(currProject, workingDirectory, this, builder.getErrorParsers());
1907
				ErrorParserManager epm = new ErrorParserManager(currProject, workingDirectory, this, builder.getErrorParsers());
1904
				epm.setOutputStream(streamMon);
1908
				epm.setOutputStream(streamMon);
1909
				epm.setErrorStream(ces); // Nils
1905
				OutputStream stdout = epm.getOutputStream();
1910
				OutputStream stdout = epm.getOutputStream();
1906
				OutputStream stderr = epm.getOutputStream();
1911
				//OutputStream stderr = epm.getOutputStream();
1912
				OutputStream stderr = epm.getErrorStream(); // Nils
1907
				// Sniff console output for scanner info
1913
				// Sniff console output for scanner info
1908
//				ICfgScannerConfigBuilderInfo2Set container = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(cfg);
1914
//				ICfgScannerConfigBuilderInfo2Set container = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(cfg);
1909
//				CfgInfoContext context = new CfgInfoContext(cfg);
1915
//				CfgInfoContext context = new CfgInfoContext(cfg);
Lines 1969-1974 Link Here
1969
				consoleErr.close();
1975
				consoleErr.close();
1970
				epm.reportProblems();
1976
				epm.reportProblems();
1971
				cos.close();
1977
				cos.close();
1978
				ces.close(); // Nils
1979
				cis.close();				
1972
			}
1980
			}
1973
		} catch (Exception e) {
1981
		} catch (Exception e) {
1974
			CCorePlugin.log(e);
1982
			CCorePlugin.log(e);
(-)src/org/eclipse/cdt/core/ErrorParserManager.java (-51 / +99 lines)
Lines 6-12 Link Here
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *   IBM Corporation        - initial API and implementation
10
 *   Siemens AG, Nils Hagge - Added using the different output, error, 
11
 *                            and info streams 
10
 *******************************************************************************/
12
 *******************************************************************************/
11
package org.eclipse.cdt.core;
13
package org.eclipse.cdt.core;
12
14
Lines 33-42 Link Here
33
import org.eclipse.core.runtime.IPath;
35
import org.eclipse.core.runtime.IPath;
34
import org.eclipse.core.runtime.Path;
36
import org.eclipse.core.runtime.Path;
35
37
36
public class ErrorParserManager extends OutputStream {
38
public class ErrorParserManager //extends OutputStream 
37
39
{
38
	private int nOpens;
39
40
41
//	private int nOpens;
42
  private int nTotalOpens;  // Nils
43
	
40
	private final static String OLD_PREF_ERROR_PARSER = "errorOutputParser"; //$NON-NLS-1$
44
	private final static String OLD_PREF_ERROR_PARSER = "errorOutputParser"; //$NON-NLS-1$
41
	public final static String PREF_ERROR_PARSER = CCorePlugin.PLUGIN_ID + ".errorOutputParser"; //$NON-NLS-1$
45
	public final static String PREF_ERROR_PARSER = CCorePlugin.PLUGIN_ID + ".errorOutputParser"; //$NON-NLS-1$
42
46
Lines 52-58 Link Here
52
	private IPath fBaseDirectory;
56
	private IPath fBaseDirectory;
53
57
54
	private String previousLine;
58
	private String previousLine;
55
	private OutputStream outputStream;
59
60
	//private OutputStream outputStream;
61
	// keep output and error stream separate
62
	private ScanOutputStream outputSink = new ScanOutputStream(); //Nils
63
	private ScanOutputStream errorSink = new ScanOutputStream();
64
	
56
	private StringBuffer currentLine = new StringBuffer();
65
	private StringBuffer currentLine = new StringBuffer();
57
66
58
	private StringBuffer scratchBuffer = new StringBuffer();
67
	private StringBuffer scratchBuffer = new StringBuffer();
Lines 360-366 Link Here
360
	 * @param cos
369
	 * @param cos
361
	 */
370
	 */
362
	public void setOutputStream(OutputStream os) {
371
	public void setOutputStream(OutputStream os) {
363
		outputStream = os;
372
		//outputStream = os;
373
		outputSink.setTarget(os);
364
	}
374
	}
365
375
366
	/**
376
	/**
Lines 369-423 Link Here
369
	 * @return OutputStream
379
	 * @return OutputStream
370
	 */
380
	 */
371
	public OutputStream getOutputStream() {
381
	public OutputStream getOutputStream() {
372
		nOpens++;
382
		//nOpens++;
373
		return this;
383
		outputSink.open();
374
	}
384
		return outputSink;
375
376
	/**
377
	 * @see java.io.OutputStream#close()
378
	 */
379
	public void close() throws IOException {
380
		if (nOpens > 0 && --nOpens == 0) {
381
			checkLine(true);
382
			fDirectoryStack.removeAllElements();
383
			fBaseDirectory = null;
384
			if (outputStream != null)
385
				outputStream.close();
386
		}
387
	}
385
	}
388
386
	
389
	/**
387
	public OutputStream getErrorStream()
390
	 * @see java.io.OutputStream#flush()
388
	{
391
	 */
389
		errorSink.open();
392
	public void flush() throws IOException {
390
		return errorSink;
393
		if (outputStream != null)
394
			outputStream.flush();
395
	}
391
	}
396
392
	
397
	/**
393
	public void setErrorStream(OutputStream es)
398
	 * @see java.io.OutputStream#write(int)
394
	{
399
	 */
395
		errorSink.setTarget(es);
400
	public synchronized void write(int b) throws IOException {
401
		currentLine.append((char) b);
402
		checkLine(false);
403
		if (outputStream != null)
404
			outputStream.write(b);
405
	}
396
	}
406
397
		
407
	public synchronized void write(byte[] b, int off, int len) throws IOException {
398
	// Nils Hagge
408
		if (b == null) {
399
	private class ScanOutputStream extends OutputStream
409
			throw new NullPointerException();
400
	{
410
		} else if (off != 0 || (len < 0) || (len > b.length)) {
401
		private OutputStream target = null;
411
			throw new IndexOutOfBoundsException();
402
		private int nOpens; // number of references to this ScanOutputStream
412
		} else if (len == 0) {
403
	
413
			return;
404
		public void open()
405
		{
406
			nOpens++;
407
			nTotalOpens++;
408
		}
409
		
410
		public void setTarget(OutputStream target)
411
		{
412
			this.target = target;
413
		}
414
		
415
  	/**
416
	   * @see java.io.OutputStream#flush()
417
	   */
418
		public void flush() throws IOException
419
		{
420
			if(target != null)
421
				target.flush();
422
		}
423
424
		/**
425
		 * @see java.io.OutputStream#write(int)
426
		 */
427
		public synchronized void write(int b) throws IOException
428
		{
429
			currentLine.append((char) b);
430
			checkLine(false);
431
			if(target != null)
432
				target.write(b);
433
		}
434
435
		public synchronized void write(byte[] b, int off, int len)
436
				throws IOException
437
		{
438
			if(b == null)
439
				throw new NullPointerException();
440
			else if(off != 0 || (len < 0) || (len > b.length))
441
				throw new IndexOutOfBoundsException();
442
			else if(len == 0)
443
				return;
444
445
			currentLine.append(new String(b, 0, len));
446
			checkLine(false);
447
			if(target != null)
448
				target.write(b, off, len);
449
		}
450
		
451
		/**
452
		 * @see java.io.OutputStream#close()
453
		 */
454
		public void close() throws IOException {
455
			if(nTotalOpens > 0 && --nTotalOpens == 0)
456
			{
457
				checkLine(true);
458
				fDirectoryStack.removeAllElements();
459
				fBaseDirectory = null;
460
			}
461
			if (nOpens > 0 && --nOpens == 0) 
462
			{
463
				if(target != null)
464
					target.close();
465
			}
414
		}
466
		}
415
		currentLine.append(new String(b, 0, len));
416
		checkLine(false);
417
		if (outputStream != null)
418
			outputStream.write(b, off, len);
419
	}
467
	}
420
468
	
421
	private void checkLine(boolean flush) {
469
	private void checkLine(boolean flush) {
422
		String buffer = currentLine.toString();
470
		String buffer = currentLine.toString();
423
		int i = 0;
471
		int i = 0;
Lines 440-446 Link Here
440
488
441
	public boolean reportProblems() {
489
	public boolean reportProblems() {
442
		boolean reset = false;
490
		boolean reset = false;
443
		if (nOpens == 0) {
491
		if (nTotalOpens == 0) {
444
			Iterator iter = fErrors.iterator();
492
			Iterator iter = fErrors.iterator();
445
			while (iter.hasNext()) {
493
			while (iter.hasNext()) {
446
				ProblemMarkerInfo problemMarkerInfo = (ProblemMarkerInfo) iter.next();
494
				ProblemMarkerInfo problemMarkerInfo = (ProblemMarkerInfo) iter.next();
(-).settings/org.eclipse.jdt.core.prefs (-6 / +7 lines)
Lines 1-7 Link Here
1
#Mon Dec 03 14:56:53 CET 2007
1
#Mon Dec 03 15:25:06 CET 2007
2
eclipse.preferences.version=1
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
3
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
4
org.eclipse.jdt.core.compiler.compliance=1.4
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
5
org.eclipse.jdt.core.compiler.compliance=1.5
6
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
7
org.eclipse.jdt.core.compiler.source=1.3
7
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8
org.eclipse.jdt.core.compiler.source=1.5

Return to bug 203727