Bug 4093 - CDT parser gives NPE on simple C++ file
Summary: CDT parser gives NPE on simple C++ file
Status: RESOLVED FIXED
Alias: None
Product: frysk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Rick Moseley
URL:
Keywords:
Depends on:
Blocks: 1633
  Show dependency treegraph
 
Reported: 2007-02-23 18:28 UTC by Rick Moseley
Modified: 2007-02-27 15:53 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
test c++ file that causes the problem (479 bytes, text/x-c++src)
2007-02-23 18:31 UTC, Rick Moseley
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Moseley 2007-02-23 18:28:53 UTC
While looking for a more robust test for the CDTParser, particularly a C++ one,
I downloaded one and used the fparser(stand-alone) utiltity to check it out to
see what sort of a DOM it created.  To my surprise it aborted the parser inside
the CDTParser code.  The following stacktrace was produced:

Exception in thread "main" java.lang.NullPointerException
   at org.eclipse.cdt.internal.core.parser.Parser.failParse(Parser.java:283)
   at
org.eclipse.cdt.internal.core.parser.Parser.failParseWithErrorHandling(Parser.java:3112)
   at org.eclipse.cdt.internal.core.parser.Parser.translationUnit(Parser.java:3059)
   at org.eclipse.cdt.internal.core.parser.Parser.parse(Parser.java:2970)
   at frysk.dom.cparser.CDTParser.parse(CDTParser.java:176)
   at fparser.main(fparser.java:199)

I will attach the file that caused the abort in an attachment.
Comment 1 Rick Moseley 2007-02-23 18:31:56 UTC
Created attachment 1579 [details]
test c++ file that causes the problem

compile with "g++ -g -o test_cpp" and run fparser on the executable.
Comment 2 Rick Moseley 2007-02-27 15:53:29 UTC
Fixed in Parser.java.  It now checks for a null LA(1) class before attempting to
access any of its methods.