Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Scanner NPE (was: Indexing show stopper parser patch)

Thomas Fletcher <thomasf@xxxxxxx> said:

> 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?)

My attempts to determine a simple test case with this code have not
been successfull, however the context for this is that at the point
where we are processing a local inclusion in handle inclusion we have
(webmail formatting applied) in Scanner.java:handleInclusion():

else // local inclusion
{
String currentFilename = contextStack.getCurrentContext().getFilename(); 
File currentIncludeFile = new File( currentFilename );
String parentDirectory = currentIncludeFile.
                             getParentFile().getAbsolutePath();
currentIncludeFile = null; 
newPath = parentDirectory + File.separatorChar + fileName;
File includeFile = new File( newPath );
if (includeFile.exists() && includeFile.isFile()) {
...

The currentFilename is "<text>" which has a special meaning to the
scanner, which when it winds up generating the null parent.

It would be easy enough to just drop out, but I'm quite certain
that that is not the real root of the problem.

Still digging, but I thought this might be meaningful to John.

Thanks,
 Thomas	



Back to the top