[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Second try at indexer cycling patch
|
So,
Here is a second try at a simple fix for the complex problem of parser
vs indexer (aka PR 51232). Rather than put the exception handing in the
parser, push it down one level to the SourceIndexer. This is a temporary
solution for the 1.2.x branch only since it will be more appropriately
re-visited in the 2.0 timeframe.
The patch just catches all exceptions and forwards those it knows about
and silently acts as if the parser failed "normally" for those exceptions
it is not aware of.
For the ChangeLog:
- Enhance the error recovery capabilities of the indexer in cases of
tumultuous parser failures.
--- PATCH START ---
Index: index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java
===================================================================
RCS
file: /home/tools/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/se
arch/indexing/SourceIndexer.java,v
retrieving revision 1.13
diff -u -r1.13 SourceIndexer.java
--- index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java
1 Oct 2003 22:15:34 -0000 1.13
+++ index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java
9 Feb 2004 14:09:01 -0000
@@ -88,7 +88,17 @@
ParserFactory.createScanner( new StringReader(
document.getStringContent() ), resourceFile.getLocation().toOSString(),
scanInfo, ParserMode.COMPLETE_PARSE, language, requestor ),
requestor,
ParserMode.COMPLETE_PARSE, language );
- boolean retVal = parser.parse();
+ //TF CHANGE: Do what we can to protect against stray parser
errors. We let IOExceptions flow
+ //through since they are handled explicitly by the API.
Other exceptions we treat as failures
+ boolean retVal = false;
+ try {
+ retVal = parser.parse();
+ } catch(Exception ex) {
+ if(ex instanceof IOException) {
+ throw (IOException)ex;
+ }
+ /* Other parse errors are just "failures" */
+ }
if (!retVal)
org.eclipse.cdt.internal.core.model.Util.log
(null, "Failed to index " + resourceFile.getFullPath(), ICLogConstants.CDT);
--- PATCH END ---
Index: index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java,v
retrieving revision 1.13
diff -u -r1.13 SourceIndexer.java
--- index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java 1 Oct 2003 22:15:34 -0000 1.13
+++ index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java 9 Feb 2004 14:09:01 -0000
@@ -88,7 +88,17 @@
ParserFactory.createScanner( new StringReader( document.getStringContent() ), resourceFile.getLocation().toOSString(), scanInfo, ParserMode.COMPLETE_PARSE, language, requestor ),
requestor, ParserMode.COMPLETE_PARSE, language );
- boolean retVal = parser.parse();
+ //TF CHANGE: Do what we can to protect against stray parser errors. We let IOExceptions flow
+ //through since they are handled explicitly by the API. Other exceptions we treat as failures
+ boolean retVal = false;
+ try {
+ retVal = parser.parse();
+ } catch(Exception ex) {
+ if(ex instanceof IOException) {
+ throw (IOException)ex;
+ }
+ /* Other parse errors are just "failures" */
+ }
if (!retVal)
org.eclipse.cdt.internal.core.model.Util.log(null, "Failed to index " + resourceFile.getFullPath(), ICLogConstants.CDT);