[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: Rejected: [cdt-patch] Indexing show stopper parser patch
|
John Camelon <jcamelon@xxxxxxxxxx> said:
> Adding this will cause the error handling necessary to build the Outline
> View on imperfect files to break.
> IProblem support in CDT 2.0 shall address the logging and client control
> over handling particular errors.
Bummmer. In the meantime my indexer is cycling continuously over a
massive project with no way to stop it =;-). If we are depending on
this to potentially be throwing exceptions, then should we be advertising
that with a blanket statement of the type:
public boolean parse() throws Exception
-> A catchall to let users know to expect failure every now and then.
> Why is the Indexer using the result of parse() to determine whether or
> not everything it has received is OK?
This is another issue, I believe that Bogdan has put in a PR for further
discussion.
In the meantime, I have tracked down at least one of the problems causing
this exception to a NPE in Scanner.java:handleInclusion() where we call
File.getParent().getFilename()
Unfortunately getParent() can return null, and does so in this case
throwing us for the exception which I caught with this patch. I'll
submit a patch for this as soon as I figure out what the proper
behaviour is supposed to be. (and hopefully a test case?)
Thanks,
Thomas
> cdt-patch-admin@xxxxxxxxxxx wrote on 02/05/2004 05:11:31 AM:
>
> >
> > I've filed a PR for this 51232, but in a nutshell every now and then
> > the Parser's translationUnit call will throw an unexpected exception
> > (these cases to be investigated as a secondary activity) which then
> > causes all components which are expecting a binary return of parsed/
> > notparsed from the Parser.java->parse() to fail. The indexer is
> > one of these components unfortunately and when this occurs the entire
> > index is considered empty.
> >
> > This patch wraps the translationUnit() call in parse() with an
> > exception blanket and "logs" these failures and turns them into
> > normall (well expected) parse failures.
> >
> > This is acutally a significant problem in several code bases I'm
> > looking at. I'll hopefully generate some good test cases as well.
> >
> > ChangeLog
> > - Wrap the call to translationUnit() with an exception clause to
> > ensure that we return sane parsed/notparsed values back to the
> > users of the Parser.
> >
> > --- PATCH START ---
> > Index: parser/org/eclipse/cdt/internal/core/parser/Parser.java
> > ===================================================================
> > RCS
> > file:
> /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/p
> > arser/Parser.java,v
> > retrieving revision 1.120.2.4
> > diff -u -r1.120.2.4 Parser.java
> > --- parser/org/eclipse/cdt/internal/core/parser/Parser.java 5 Nov
> 2003
>
> > 18:14:51 -0000 1.120.2.4
> > +++ parser/org/eclipse/cdt/internal/core/parser/Parser.java 5 Feb
> 2004
>
> > 11:55:47 -0000
> > @@ -136,7 +136,14 @@
> > public boolean parse()
> > {
> > long startTime = System.currentTimeMillis();
> > - translationUnit();
> > + try {
> > + translationUnit();
> > + } catch(Exception ex) {
> > + /* Critical error condition which should be logged */
> > + ex.printStackTrace();
> > + parsePassed = false;
> > + }
> > +
> > // For the debuglog to take place, you have to call
> > // Util.setDebugging(true);
> > // Or set debug to true in the core plugin preference
> > Index:
> search/org/eclipse/cdt/core/search/BasicSearchResultCollector.java
> > ===================================================================
> > RCS
> > file:
> /home/tools/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/Bas
> > icSearchResultCollector.java,v
> > retrieving revision 1.8
> > diff -u -r1.8 BasicSearchResultCollector.java
> > --- search/org/eclipse/cdt/core/search/BasicSearchResultCollector.java
>
> 23
> > Sep 2003 13:54:21 -0000 1.8
> > +++ search/org/eclipse/cdt/core/search/BasicSearchResultCollector.java
> 5
>
> > Feb 2004 11:55:47 -0000
> > @@ -53,6 +53,14 @@
> > * Window>Preferences>Java>Code Generation>Code and Comments
> > */
> > public class BasicSearchResultCollector implements
> ICSearchResultCollector {
> > + IProgressMonitor fProgressMonitor = null;
> > +
> > + public BasicSearchResultCollector() {
> > + }
> > +
> > + public BasicSearchResultCollector(IProgressMonitor monitor) {
> > + fProgressMonitor = monitor;
> > + }
> >
> > public void aboutToStart() {
> > results = new HashSet();
> > @@ -62,7 +70,7 @@
> > }
> >
> > public IProgressMonitor getProgressMonitor() {
> > - return null;
> > + return fProgressMonitor;
> > }
> >
> > public IMatch createMatch(Object fileResource, int start, int end,
>
> > ISourceElementCallbackDelegate node ) throws CoreException
> > Index:
> search/org/eclipse/cdt/internal/core/search/processing/JobManager.java
> > ===================================================================
> > RCS
> > file:
> /home/tools/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/s
> > earch/processing/JobManager.java,v
> > retrieving revision 1.5.2.1
> > diff -u -r1.5.2.1 JobManager.java
> > ---
> search/org/eclipse/cdt/internal/core/search/processing/JobManager.java
> > 27 Oct 2003 20:44:57 -0000 1.5.2.1
> > +++
> search/org/eclipse/cdt/internal/core/search/processing/JobManager.java
> > 5 Feb 2004 11:55:48 -0000
> > @@ -268,7 +268,14 @@
> > previousJob
> > = currentJob;
> > }
> > try {
> > - Thread.sleep
> > (50);
> > + //Wake up
> > less often if there is a long queue ahead
> > + if
> > (awaitingWork < 1000) {
> > +
> > Thread.sleep(50);
> > + } else if
> > (awaitingWork < 5000) {
> > +
> > Thread.sleep(500);
> > + } else {
> > +
> > Thread.sleep(1000);
> > + }
> > } catch
> > (InterruptedException e) {
> > }
> > }
> >
> > --- PATCH END ---
> >
> > Index: parser/org/eclipse/cdt/internal/core/parser/Parser.java
> > ===================================================================
> > RCS file: /home/tools/org.eclipse.cdt.
> > core/parser/org/eclipse/cdt/internal/core/parser/Parser.java,v
> > retrieving revision 1.120.2.4
> > diff -u -r1.120.2.4 Parser.java
> > --- parser/org/eclipse/cdt/internal/core/parser/Parser.java 5 Nov
> > 2003 18:14:51 -0000 1.120.2.4
> > +++ parser/org/eclipse/cdt/internal/core/parser/Parser.java 5 Feb
> > 2004 11:55:47 -0000
> > @@ -136,7 +136,14 @@
> > public boolean parse()
> > {
> > long startTime = System.currentTimeMillis();
> > - translationUnit();
> > + try {
> > + translationUnit();
> > + } catch(Exception ex) {
> > + /* Critical error condition which should be logged */
> > + ex.printStackTrace();
> > + parsePassed = false;
> > + }
> > +
> > // For the debuglog to take place, you have to call
> > // Util.setDebugging(true);
> > // Or set debug to true in the core plugin preference
> > Index:
> search/org/eclipse/cdt/core/search/BasicSearchResultCollector.java
> > ===================================================================
> > RCS file: /home/tools/org.eclipse.cdt.
> >
> core/search/org/eclipse/cdt/core/search/BasicSearchResultCollector.java,
> v
> > retrieving revision 1.8
> > diff -u -r1.8 BasicSearchResultCollector.java
> > --- search/org/eclipse/cdt/core/search/BasicSearchResultCollector.
> > java 23 Sep 2003 13:54:21 -0000 1.8
> > +++ search/org/eclipse/cdt/core/search/BasicSearchResultCollector.
> > java 5 Feb 2004 11:55:47 -0000
> > @@ -53,6 +53,14 @@
> > * Window>Preferences>Java>Code Generation>Code and Comments
> > */
> > public class BasicSearchResultCollector implements
> ICSearchResultCollector {
> > + IProgressMonitor fProgressMonitor = null;
> > +
> > + public BasicSearchResultCollector() {
> > + }
> > +
> > + public BasicSearchResultCollector(IProgressMonitor monitor) {
> > + fProgressMonitor = monitor;
> > + }
> >
> > public void aboutToStart() {
> > results = new HashSet();
> > @@ -62,7 +70,7 @@
> > }
> >
> > public IProgressMonitor getProgressMonitor() {
> > - return null;
> > + return fProgressMonitor;
> > }
> >
> > public IMatch createMatch(Object fileResource, int start, int
> > end, ISourceElementCallbackDelegate node ) throws CoreException
> > Index:
> search/org/eclipse/cdt/internal/core/search/processing/JobManager.java
> > ===================================================================
> > RCS file: /home/tools/org.eclipse.cdt.
> >
> core/search/org/eclipse/cdt/internal/core/search/processing/JobManager.j
> ava,v
> > retrieving revision 1.5.2.1
> > diff -u -r1.5.2.1 JobManager.java
> > ---
> > search/org/eclipse/cdt/internal/core/search/processing/JobManager.
> > java 27 Oct 2003 20:44:57 -0000 1.5.2.1
> > +++
> > search/org/eclipse/cdt/internal/core/search/processing/JobManager.
> > java 5 Feb 2004 11:55:48 -0000
> > @@ -268,7 +268,14 @@
> > previousJob = currentJob;
> > }
> > try {
> > - Thread.sleep(50);
> > + //Wake up less often if there is a long queue
>
> ahead
> > + if(awaitingWork < 1000) {
> > + Thread.sleep(50);
> > + } else if(awaitingWork < 5000) {
> > + Thread.sleep(500);
> > + } else {
> > + Thread.sleep(1000);
> > + }
> > } catch (InterruptedException e) {
> > }
> > }
>
> _______________________________________________
> cdt-patch mailing list
> cdt-patch@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/cdt-patch
>
--