mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +02:00
Bug 337487 - Bad exception handling in Codan
This commit is contained in:
parent
59efc020b2
commit
1d85f97705
8 changed files with 26 additions and 25 deletions
|
@ -35,7 +35,6 @@ public abstract class AbstractAstRewriteQuickFix extends AbstractCodanCMarkerRes
|
||||||
try {
|
try {
|
||||||
index = getIndexFromMarker(marker);
|
index = getIndexFromMarker(marker);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
e.printStackTrace();
|
|
||||||
CheckersUiActivator.log(e);
|
CheckersUiActivator.log(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +50,7 @@ public abstract class AbstractAstRewriteQuickFix extends AbstractCodanCMarkerRes
|
||||||
index.releaseReadLock();
|
index.releaseReadLock();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
CheckersUiActivator.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
|
package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
|
||||||
|
|
||||||
import org.eclipse.cdt.codan.core.cxx.CxxAstUtils;
|
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.IASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
|
@ -60,7 +61,7 @@ public class QuickFixCreateField extends AbstractAstRewriteQuickFix {
|
||||||
Change c = r.rewriteAST();
|
Change c = r.rewriteAST();
|
||||||
c.perform(new NullProgressMonitor());
|
c.perform(new NullProgressMonitor());
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
e.printStackTrace();
|
CheckersUiActivator.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.codan.internal.checkers;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
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.cxx.model.AbstractIndexAstChecker;
|
||||||
import org.eclipse.cdt.codan.core.model.ICheckerWithPreferences;
|
import org.eclipse.cdt.codan.core.model.ICheckerWithPreferences;
|
||||||
import org.eclipse.cdt.codan.core.model.IProblem;
|
import org.eclipse.cdt.codan.core.model.IProblem;
|
||||||
|
@ -73,7 +74,7 @@ public class NamingConventionFunctionChecker extends AbstractIndexAstChecker imp
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
CodanCheckersActivator.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.codan.internal.checkers;
|
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.CxxAstUtils;
|
||||||
import org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker;
|
import org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
|
@ -143,13 +144,13 @@ public class ProblemBindingChecker extends AbstractIndexAstChecker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
e.printStackTrace();
|
CodanCheckersActivator.log(e);
|
||||||
}
|
}
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
CodanCheckersActivator.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,6 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
try {
|
try {
|
||||||
((ICheckerWithPreferences) c).initPreferences((IProblemWorkingCopy) p);
|
((ICheckerWithPreferences) c).initPreferences((IProblemWorkingCopy) p);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
t.printStackTrace();
|
|
||||||
CodanCorePlugin.log(t);
|
CodanCorePlugin.log(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,7 +227,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#iterator()
|
* @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#iterator()
|
||||||
*/
|
*/
|
||||||
public Iterator<IChecker> iterator() {
|
public Iterator<IChecker> iterator() {
|
||||||
|
@ -246,7 +245,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addChecker(org.eclipse
|
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addChecker(org.eclipse
|
||||||
* .cdt.codan.core.model.IChecker)
|
* .cdt.codan.core.model.IChecker)
|
||||||
|
@ -257,7 +256,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addProblem(org.eclipse
|
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addProblem(org.eclipse
|
||||||
* .cdt.codan.core.model.IProblem, java.lang.String)
|
* .cdt.codan.core.model.IProblem, java.lang.String)
|
||||||
|
@ -271,7 +270,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addCategory(org.eclipse
|
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addCategory(org.eclipse
|
||||||
* .cdt.codan.core.model.IProblemCategory, java.lang.String)
|
* .cdt.codan.core.model.IProblemCategory, java.lang.String)
|
||||||
|
@ -285,7 +284,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addRefProblem(org.
|
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addRefProblem(org.
|
||||||
* eclipse.cdt.codan.core.model.IChecker,
|
* 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
|
* Returns list of problems registered for given checker
|
||||||
*
|
*
|
||||||
* @return collection of problems or null
|
* @return collection of problems or null
|
||||||
*/
|
*/
|
||||||
public Collection<IProblem> getRefProblems(IChecker checker) {
|
public Collection<IProblem> getRefProblems(IChecker checker) {
|
||||||
|
@ -311,7 +310,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getDefaultProfile()
|
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getDefaultProfile()
|
||||||
*/
|
*/
|
||||||
|
@ -321,7 +320,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getWorkspaceProfile()
|
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getWorkspaceProfile()
|
||||||
*/
|
*/
|
||||||
|
@ -352,7 +351,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getResourceProfile
|
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getResourceProfile
|
||||||
* (org.eclipse.core.resources.IResource)
|
* (org.eclipse.core.resources.IResource)
|
||||||
|
@ -386,7 +385,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @seeorg.eclipse.cdt.codan.core.model.ICheckersRegistry#
|
* @seeorg.eclipse.cdt.codan.core.model.ICheckersRegistry#
|
||||||
* getResourceProfileWorkingCopy(org.eclipse.core.resources.IResource)
|
* 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
|
* Tests if a checker is enabled (needs to be run) or not. Checker is
|
||||||
* enabled
|
* enabled
|
||||||
* if at least one problem it reports is enabled.
|
* if at least one problem it reports is enabled.
|
||||||
*
|
*
|
||||||
* @param checker
|
* @param checker
|
||||||
* @param resource
|
* @param resource
|
||||||
* @return <code>true</code> if the checker is enabled
|
* @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.
|
* Tests if a checker needs to run in a specific launch mode.
|
||||||
*
|
*
|
||||||
* @param checker
|
* @param checker
|
||||||
* @param resource
|
* @param resource
|
||||||
* @param mode
|
* @param mode
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -93,7 +93,7 @@ public class CodanMarkerProblemReporter extends AbstractProblemReporter implemen
|
||||||
try {
|
try {
|
||||||
file.deleteMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE, true, IResource.DEPTH_ZERO);
|
file.deleteMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE, true, IResource.DEPTH_ZERO);
|
||||||
} catch (CoreException ce) {
|
} catch (CoreException ce) {
|
||||||
ce.printStackTrace();
|
CodanCorePlugin.log(ce);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ public class CodanMarkerProblemReporter extends AbstractProblemReporter implemen
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemReporterSessionPersistent#
|
* @see org.eclipse.cdt.codan.core.model.IProblemReporterSessionPersistent#
|
||||||
* deleteProblems(boolean)
|
* deleteProblems(boolean)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,6 +16,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.codan.core.CodanCorePlugin;
|
import org.eclipse.cdt.codan.core.CodanCorePlugin;
|
||||||
import org.eclipse.cdt.codan.core.PreferenceConstants;
|
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.cdt.codan.internal.ui.CodanUIMessages;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.ProjectScope;
|
import org.eclipse.core.resources.ProjectScope;
|
||||||
|
@ -338,9 +339,9 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
|
||||||
// and show it
|
// and show it
|
||||||
showPreferencePage(pageId, page);
|
showPreferencePage(pageId, page);
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
e.printStackTrace();
|
CodanUIActivator.log(e);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
CodanUIActivator.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,6 @@ public abstract class AbstractCodanCMarkerResolution implements IMarkerResolutio
|
||||||
try {
|
try {
|
||||||
editorPart = CodanEditorUtility.openInEditor(marker);
|
editorPart = CodanEditorUtility.openInEditor(marker);
|
||||||
} catch (PartInitException e) {
|
} catch (PartInitException e) {
|
||||||
e.printStackTrace();
|
|
||||||
CodanUIActivator.log(e);
|
CodanUIActivator.log(e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue