1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Exception reading from index, bug 201307.

This commit is contained in:
Markus Schorn 2008-06-18 07:38:46 +00:00
parent fbe5d4b7db
commit 677ff3aff6

View file

@ -21,6 +21,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
/** /**
@ -39,18 +40,20 @@ public class PDOMProjectIndexLocationConverter implements IIndexLocationConverte
*/ */
public IIndexFileLocation fromInternalFormat(String raw) { public IIndexFileLocation fromInternalFormat(String raw) {
String fullPath = null; String fullPath = null;
URI uri; URI uri= null;
if(raw.startsWith(EXTERNAL)) { if(raw.startsWith(EXTERNAL)) {
try { try {
uri = new URI(raw.substring(EXTERNAL.length())); uri = new URI(raw.substring(EXTERNAL.length()));
} catch(URISyntaxException use) { } catch(URISyntaxException use) {
uri = null;
} }
} else { } else {
fullPath = raw; fullPath= raw;
IResource member= root.getFile(new Path(raw)); final IPath path= new Path(raw);
if (path.segmentCount() > 1) {
IResource member= root.getFile(path);
uri = member.getLocationURI(); uri = member.getLocationURI();
} }
}
return uri == null ? null : new IndexFileLocation(uri, fullPath); return uri == null ? null : new IndexFileLocation(uri, fullPath);
} }