This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 59560

Summary: Bad apisupport project declaration suspends IDE start-up
Product: apisupport Reporter: _ tball <tball>
Component: ProjectAssignee: Jesse Glick <jglick>
Status: RESOLVED DUPLICATE    
Severity: blocker    
Priority: P3    
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: stacktrace

Description _ tball 2005-06-02 19:17:22 UTC
If you create a 4.2 NetBeans module project and define an
<extra-compilation-unit> without a <classpath> element in its project.xml file,
the error isn't caught until the next time the IDE starts.  When that happens,
an assertion is thrown which causes the IDE start-up to suspend.

I see two related problems.  First, an explicit test with an exception should be
used rather than an assertion, since this is testing a potentially invalid
configuration file (assertions should be reserved for "can't fail" situations).
 Second, the open-projects lookup should catch exceptions, perhaps not opening
bad projects after reporting the problem along with the name of the bad project.
Comment 1 _ tball 2005-06-02 19:17:54 UTC
Created attachment 22458 [details]
stacktrace
Comment 2 Jesse Glick 2005-06-03 00:24:15 UTC
Re. exception vs. assertion - yes of course; the reason there is no complex
error handling for this or any similar cases in other project types is that it
should be handled more simply in the future by schema validation (issue #42686)
but we have not yet implemented that. The use of assertions will be reasonable
when that is implemented.

Can make OpenProjectList catch RuntimeException - no plans to catch Error.

*** This issue has been marked as a duplicate of 42686 ***
Comment 3 _ tball 2005-06-09 17:14:04 UTC
Regardless of how (or even if) the project.xml is validated, IDE start-up
shouldn't hang when a bad file is discovered.  What appears to be happening is
that due to the assertion being thrown, the "open project list" task aborts but
the IDE waits forever for its completion with only the splash screen being
displayed.  The only way I could figure out how to "fix" this is to discard my
.netbeans/dev directory, which also deleted all of my settings.

To duplicate this error, open the autoupdate project (hopefully before it's
fixed).  It should display the assertion error.  Then exit the IDE and attempt
to re-enter it with the same userdir.  The IDE should throw the same assertion,
and then hang.
Comment 4 _ tball 2005-06-09 17:17:03 UTC
I tried adding a try/catch block in
projectuiapi/src/org/netbeans/spi/project/ui/ProjectOpenedHook.java around the
project opened forwarding, and the IDE recovered from the assertion failure.
Comment 5 Jesse Glick 2005-06-09 21:36:54 UTC
"IDE start-up shouldn't hang when a bad file is discovered": sure, but there is
no rule about what happens when assertion errors are thrown. (POH already
catches RuntimeException's, and NbInstaller.loadCode should probably be patched
to catch AssertionError.) The assertion errors need to *not* be thrown, which I
think is best solved by issue #42686. In the meantime, don't edit project.xml
files to be invalid acc. to schema.

*** This issue has been marked as a duplicate of 42686 ***
Comment 6 Jesse Glick 2005-06-09 21:44:34 UTC
I will patch NbInstaller.loadCode soon.