1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 01:35:39 +02:00

Bug 337487 - Bad exception handling in Codan

This commit is contained in:
Alena Laskavaia 2011-02-24 02:23:23 +00:00
parent 59efc020b2
commit 1d85f97705
8 changed files with 26 additions and 25 deletions

View file

@ -35,7 +35,6 @@ public abstract class AbstractAstRewriteQuickFix extends AbstractCodanCMarkerRes
try {
index = getIndexFromMarker(marker);
} catch (CoreException e) {
e.printStackTrace();
CheckersUiActivator.log(e);
return;
}
@ -51,7 +50,7 @@ public abstract class AbstractAstRewriteQuickFix extends AbstractCodanCMarkerRes
index.releaseReadLock();
}
} catch (Exception e) {
e.printStackTrace();
CheckersUiActivator.log(e);
}
}

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
import org.eclipse.cdt.codan.core.cxx.CxxAstUtils;
import org.eclipse.cdt.codan.internal.checkers.ui.CheckersUiActivator;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
@ -60,7 +61,7 @@ public class QuickFixCreateField extends AbstractAstRewriteQuickFix {
Change c = r.rewriteAST();
c.perform(new NullProgressMonitor());
} catch (CoreException e) {
e.printStackTrace();
CheckersUiActivator.log(e);
}
}

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.codan.internal.checkers;
import java.util.regex.Pattern;
import org.eclipse.cdt.codan.checkers.CodanCheckersActivator;
import org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker;
import org.eclipse.cdt.codan.core.model.ICheckerWithPreferences;
import org.eclipse.cdt.codan.core.model.IProblem;
@ -73,7 +74,7 @@ public class NamingConventionFunctionChecker extends AbstractIndexAstChecker imp
}
});
} catch (Exception e) {
e.printStackTrace();
CodanCheckersActivator.log(e);
}
}

View file

@ -11,6 +11,7 @@
*******************************************************************************/
package org.eclipse.cdt.codan.internal.checkers;
import org.eclipse.cdt.codan.checkers.CodanCheckersActivator;
import org.eclipse.cdt.codan.core.cxx.CxxAstUtils;
import org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
@ -143,13 +144,13 @@ public class ProblemBindingChecker extends AbstractIndexAstChecker {
}
}
} catch (DOMException e) {
e.printStackTrace();
CodanCheckersActivator.log(e);
}
return PROCESS_CONTINUE;
}
});
} catch (Exception e) {
e.printStackTrace();
CodanCheckersActivator.log(e);
}
}

View file

@ -95,7 +95,6 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
try {
((ICheckerWithPreferences) c).initPreferences((IProblemWorkingCopy) p);
} catch (Throwable t) {
t.printStackTrace();
CodanCorePlugin.log(t);
}
}
@ -228,7 +227,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#iterator()
*/
public Iterator<IChecker> iterator() {
@ -246,7 +245,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addChecker(org.eclipse
* .cdt.codan.core.model.IChecker)
@ -257,7 +256,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addProblem(org.eclipse
* .cdt.codan.core.model.IProblem, java.lang.String)
@ -271,7 +270,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addCategory(org.eclipse
* .cdt.codan.core.model.IProblemCategory, java.lang.String)
@ -285,7 +284,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addRefProblem(org.
* eclipse.cdt.codan.core.model.IChecker,
@ -302,7 +301,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
/**
* Returns list of problems registered for given checker
*
*
* @return collection of problems or null
*/
public Collection<IProblem> getRefProblems(IChecker checker) {
@ -311,7 +310,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getDefaultProfile()
*/
@ -321,7 +320,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getWorkspaceProfile()
*/
@ -352,7 +351,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getResourceProfile
* (org.eclipse.core.resources.IResource)
@ -386,7 +385,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
/*
* (non-Javadoc)
*
*
* @seeorg.eclipse.cdt.codan.core.model.ICheckersRegistry#
* getResourceProfileWorkingCopy(org.eclipse.core.resources.IResource)
*/
@ -404,7 +403,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
* Tests if a checker is enabled (needs to be run) or not. Checker is
* enabled
* if at least one problem it reports is enabled.
*
*
* @param checker
* @param resource
* @return <code>true</code> if the checker is enabled
@ -427,7 +426,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
/**
* Tests if a checker needs to run in a specific launch mode.
*
*
* @param checker
* @param resource
* @param mode

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2010 Alena Laskavaia
* Copyright (c) 2009, 2010 Alena Laskavaia
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -93,7 +93,7 @@ public class CodanMarkerProblemReporter extends AbstractProblemReporter implemen
try {
file.deleteMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE, true, IResource.DEPTH_ZERO);
} catch (CoreException ce) {
ce.printStackTrace();
CodanCorePlugin.log(ce);
}
}
@ -262,7 +262,7 @@ public class CodanMarkerProblemReporter extends AbstractProblemReporter implemen
/*
* (non-Javadoc)
*
*
* @see org.eclipse.cdt.codan.core.model.IProblemReporterSessionPersistent#
* deleteProblems(boolean)
*/

View file

@ -16,6 +16,7 @@ import java.util.List;
import org.eclipse.cdt.codan.core.CodanCorePlugin;
import org.eclipse.cdt.codan.core.PreferenceConstants;
import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
@ -338,9 +339,9 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
// and show it
showPreferencePage(pageId, page);
} catch (InstantiationException e) {
e.printStackTrace();
CodanUIActivator.log(e);
} catch (IllegalAccessException e) {
e.printStackTrace();
CodanUIActivator.log(e);
}
}

View file

@ -126,7 +126,6 @@ public abstract class AbstractCodanCMarkerResolution implements IMarkerResolutio
try {
editorPart = CodanEditorUtility.openInEditor(marker);
} catch (PartInitException e) {
e.printStackTrace();
CodanUIActivator.log(e);
return null;
}