1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00

Bug 430282 - Trace indexer exceptions for easier diagnosis of bugs

Change-Id: I208a77af84cc3f3dd017456133edd5e3fa4c7743
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Reviewed-on: https://git.eclipse.org/r/23743
Tested-by: Hudson CI
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
Nathan Ridge 2014-03-22 01:18:43 -04:00 committed by Sergey Prigogin
parent c8c5a78649
commit d02be6bf77
2 changed files with 14 additions and 1 deletions

View file

@ -1137,6 +1137,9 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
s= createStatus(getMessage(MessageKind.errorWhileParsing, file), e);
}
logError(s);
if (fShowProblems) {
reportException(e);
}
if (++fStatistics.fErrorCount > MAX_ERRORS) {
throw new CoreException(createStatus(getMessage(MessageKind.tooManyIndexProblems)));
}

View file

@ -63,6 +63,8 @@ import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@ -191,7 +193,7 @@ abstract public class PDOMWriter implements IPDOMASTProcessor {
}
}
private boolean fShowProblems;
protected boolean fShowProblems;
protected boolean fShowInclusionProblems;
private boolean fShowScannerProblems;
private boolean fShowSyntaxProblems;
@ -663,6 +665,14 @@ abstract public class PDOMWriter implements IPDOMASTProcessor {
String msg= "Indexer: " + problem.getMessageWithLocation(); //$NON-NLS-1$
trace(msg);
}
protected void reportException(Throwable th) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
th.printStackTrace(pw);
String msg= "Indexer: exception: " + sw.toString(); //$NON-NLS-1$
trace(msg);
}
protected void trace(String message) {
System.out.println(message);