From 52bbe25b47d7abc16f7382b0f92966465f3d0340 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Mon, 13 Nov 2006 14:57:14 +0000 Subject: [PATCH] Logs the name of the file currently parsed, together with exceptions caught by the indexer. --- .../core/pdom/indexer/PDOMIndexerTask.java | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMIndexerTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMIndexerTask.java index d6d2fefe3aa..e48bb506cb4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMIndexerTask.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMIndexerTask.java @@ -36,6 +36,7 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; @@ -128,20 +129,37 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask { } protected void parseTU(ITranslationUnit tu, IProgressMonitor pm) throws CoreException, InterruptedException { + IPath path= tu.getPath(); try { - IPath path= tu.getPath(); + if (fTrace) { + System.out.println("Indexer: parsing " + path.toOSString()); //$NON-NLS-1$ + } fMessage= MessageFormat.format(Messages.PDOMIndexerTask_parsingFileTask, new Object[]{path.lastSegment(), path.removeLastSegments(1).toString()}); doParseTU(tu, pm); } catch (CoreException e) { - if (++fErrorCount <= MAX_ERRORS) { - CCorePlugin.log(e); - } - else { + if (!swallowError(path, e)) throw e; - } } + catch (RuntimeException e) { + if (!swallowError(path, e)) + throw e; + } + catch (Error e) { + if (!swallowError(path, e)) + throw e; + } + } + + private boolean swallowError(IPath file, Throwable e) { + if (++fErrorCount <= MAX_ERRORS) { + IStatus status= CCorePlugin.createStatus( + MessageFormat.format(Messages.PDOMIndexerTask_errorWhileParsing, new Object[]{file}), e); + CCorePlugin.log(status); + return true; + } + return false; } abstract protected void doParseTU(ITranslationUnit tu, IProgressMonitor pm) throws CoreException, InterruptedException;