Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338349 - CodanCReconciler does not find resources consistenly
Summary: CodanCReconciler does not find resources consistenly
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: Sergey Prigogin CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-27 14:23 EST by Alex Ruiz CLA
Modified: 2011-03-25 18:38 EDT (History)
4 users (show)

See Also:


Attachments
Proposed patch (1.85 KB, patch)
2011-02-28 12:28 EST, Alex Ruiz CLA
eclipse.sprigogin: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Ruiz CLA 2011-02-27 14:23:46 EST
Build Identifier: 20110204-0611

org.eclipse.cdt.codan.internal.ui.cxx.CodanCReconciler uses org.eclipse.core.resources.IWorkspaceRoot to find an IResource from a java.net.URI. It works for normal file systems, but not for the customized file system we use. The problem is that Codan does not run checkers in "run in editor" mode in our projects.

The solution is to use org.eclipse.cdt.internal.core.resources.ResourceLookup#findFilesForLocationURI(URI) instead. I have tested it with regular projects and our own and it works.

Reproducible: Always

Steps to Reproduce:
It is not possible to reproduce this bug outside my workplace, because of the customizations of our development environment.
Comment 1 Alex Ruiz CLA 2011-02-28 12:28:41 EST
Created attachment 189970 [details]
Proposed patch

Patch with the proposed solution.
Comment 2 James Blackburn CLA 2011-02-28 12:40:35 EST
> String filePath = ast.getFilePath();
> URI uri = new File(filePath).toURI();
> IFile[] resources = ResourceLookup.findFilesForLocationURI(uri);

That still looks weird. How does this cope with non-file URI paths? Does this stuff support generic EFS resources at all?
Comment 3 Alex Ruiz CLA 2011-02-28 19:05:24 EST
Probably Alena is the best to answer this question :)

AFAIK, codan only works with files (at least that is the default behavior in IChecker#enabledInContext(IResource)


(In reply to comment #2)
> > String filePath = ast.getFilePath();
> > URI uri = new File(filePath).toURI();
> > IFile[] resources = ResourceLookup.findFilesForLocationURI(uri);
> 
> That still looks weird. How does this cope with non-file URI paths? Does this
> stuff support generic EFS resources at all?
Comment 4 Sergey Prigogin CLA 2011-03-25 17:49:45 EDT
Fixed in HEAD > 20110325.