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

Create dummy locations, when location no longer exists, bug 249769.

This commit is contained in:
Markus Schorn 2008-10-06 13:43:23 +00:00
parent 5a9b69c9ee
commit 22785eee86

View file

@ -12,6 +12,8 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom; package org.eclipse.cdt.internal.core.pdom.dom;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
@ -39,6 +41,7 @@ import org.eclipse.cdt.internal.core.index.IIndexFragment;
import org.eclipse.cdt.internal.core.index.IIndexFragmentFile; import org.eclipse.cdt.internal.core.index.IIndexFragmentFile;
import org.eclipse.cdt.internal.core.index.IIndexFragmentName; import org.eclipse.cdt.internal.core.index.IIndexFragmentName;
import org.eclipse.cdt.internal.core.index.IWritableIndexFragment; import org.eclipse.cdt.internal.core.index.IWritableIndexFragment;
import org.eclipse.cdt.internal.core.index.IndexFileLocation;
import org.eclipse.cdt.internal.core.index.IWritableIndex.IncludeInformation; import org.eclipse.cdt.internal.core.index.IWritableIndex.IncludeInformation;
import org.eclipse.cdt.internal.core.pdom.PDOM; import org.eclipse.cdt.internal.core.pdom.PDOM;
import org.eclipse.cdt.internal.core.pdom.db.BTree; import org.eclipse.cdt.internal.core.pdom.db.BTree;
@ -590,8 +593,16 @@ public class PDOMFile implements IIndexFragmentFile {
Database db = pdom.getDB(); Database db = pdom.getDB();
String raw = db.getString(db.getInt(record + LOCATION_REPRESENTATION)).getString(); String raw = db.getString(db.getInt(record + LOCATION_REPRESENTATION)).getString();
location= pdom.getLocationConverter().fromInternalFormat(raw); location= pdom.getLocationConverter().fromInternalFormat(raw);
if (location == null) if (location == null) {
throw new CoreException(CCorePlugin.createStatus(Messages.getString("PDOMFile.toExternalProblem")+raw)); //$NON-NLS-1$ URI uri;
try {
int idx= raw.lastIndexOf('>');
uri= new URI("file", null, raw.substring(idx+1), null); //$NON-NLS-1$
} catch (URISyntaxException e) {
uri= URI.create("file:/unknown-location"); //$NON-NLS-1$
}
location= new IndexFileLocation(uri, null);
}
} }
return location; return location;
} }