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 59615 - AIOOBE from NewFile.preselectedProject when no projects open
Summary: AIOOBE from NewFile.preselectedProject when no projects open
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Projects UI (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jesse Glick
: 61173 (view as bug list)
Depends on:
Reported: 2005-06-03 17:03 UTC by Jesse Glick
Modified: 2006-01-16 15:45 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

Stack trace (2.03 KB, text/plain)
2005-06-03 17:04 UTC, Jesse Glick

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2005-06-03 17:03:40 UTC
Dev build, Mustang. Start IDE. With no projects open, press Ctrl-N. Exception
thrown. Should rather do nothing, or beep, or something.
Comment 1 Jesse Glick 2005-06-03 17:04:07 UTC
Created attachment 22486 [details]
Stack trace
Comment 2 Martin Krauskopf 2005-07-20 14:53:57 UTC
*** Issue 61173 has been marked as a duplicate of this issue. ***
Comment 3 Jan Lahoda 2005-07-20 15:12:43 UTC
It seems to me that this was introduced in revision 1.19 of
revision 1.19
date: 2005/05/17 00:15:43;  author: jglick;  state: Exp;  lines: +7 -2
Threading fix, avoids stack trace.

The problem is IMO following:
1. The user presses Ctrl-N, on an instance of NewFile action
"createContextAwareAction" method is called with appropriate Lookup (in the AWT
Thread probably).
2. New "NewFile" action is created (newly created actions have isEnabled() == true).
3. In the NewFile's constructor, "refresh" is called. The refresh replans to AWT
Thread to perform setEnabled and setDisplayName. (originaly, the setEnabled was
called synchronously in the refresh method).
4. isEnabled() is called on the newly created action (returns true as the
setEnabled(false) has not been runned yet), and as the result is true,
actionPerformed is called (resulting in the exception).

Please note that the action should be enabled only if
"OpenProjectList.getDefault().getOpenProjects().length > 0" and in such a case
calling OpenProjectList.getDefault().getOpenProjects()[0] seems OK.
Comment 4 Jesse Glick 2005-07-20 20:18:29 UTC
Yup, needed to change enablement synch if already in EQ.
Comment 5 Jesse Glick 2005-07-20 22:13:29 UTC
Checking in
new revision: 1.20; previous revision: 1.19
Comment 6 Jaromir Uhrik 2006-01-16 15:45:48 UTC
Marking this issue as VERIFIED since the issue reporter == issue owner.