for (IRunTestFailureExt runTestFailure : runTestFailures) {
monitorCheck(monitor);
// get resource (file, usually) to associate a message/project/failure/warning and displayed in problems
// view
Component component =
projectPackageList.getComponentByNameType(runTestFailure.getName(), Constants.APEX_CLASS);
if (component == null) {
logger.warn("Unable to handle run test message - could not find component '" + runTestFailure.getName()
+ "' in list. Will attempt to find w/in project");
try {
IFile file =
getComponentFileByNameType(projectPackageList.getProject(), runTestFailure.getName(),
new String[] { Constants.APEX_CLASS });
if (file != null) {
setRunTestFailureMarker(file, runTestFailure);
} else if (projectPackageList.getProject() != null) {
StringBuffer strBuff = new StringBuffer();
strBuff.append("Unable to get file resource for '").append(runTestFailure.getName())
.append("' for code coverage warning '").append(runTestFailure.getMessage())
.append("'. Assigning failure to project.");
logger.warn(strBuff.toString());
MarkerUtils.getInstance().applyRunTestFailureMarker(projectPackageList.getProject(),
runTestFailure.getMessage());
} else {
logger.warn("Unable to get file resource for '" + runTestFailure.getName()
+ "' for run test failure " + runTestFailure.getMessage());
}
} catch (CoreException e) {
String logMessage = Utils.generateCoreExceptionLog(e);
logger.warn("Unable to get file resource for '" + runTestFailure.getName() + "' for failure "
+ runTestFailure.getMessage() + ": " + logMessage, e);
} catch (FactoryException e) {
logger.error("Unable to get file resource for '" + runTestFailure.getName() + "' for failure "
+ runTestFailure.getMessage(), e);
}
continue;
}
MarkerUtils.getInstance().applyDirty(component.getFileResource());
setRunTestFailureMarker(component.getFileResource(), runTestFailure);
applyWarningsToAssociatedComponents(projectPackageList, component);
try {
component.getFileResource().findMarkers(MarkerUtils.getInstance().MARKER_RUN_TEST_FAILURE, true,
IResource.DEPTH_INFINITE);
} catch (CoreException e) {
String logMessage = Utils.generateCoreExceptionLog(e);
logger.warn("Unable apply run test marker on component resource: " + logMessage, e);
}