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 25820 - Properties File Wizard throws NPE
Summary: Properties File Wizard throws NPE
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Dialogs&Wizards (show other bugs)
Version: 3.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-19 12:18 UTC by Milan Kuchtiak
Modified: 2008-12-22 18:46 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
WizardDescTest.java (2.23 KB, text/plain)
2002-07-22 09:32 UTC, David Konecny
Details
Diff of suggested fix (918 bytes, patch)
2002-08-05 17:26 UTC, mslama
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Milan Kuchtiak 2002-07-19 12:18:32 UTC
- create a new Blank Ant Project
- go to Project Properties and open the customizer (...)
- press Finish button

You get the NPE :

java.lang.NullPointerException
	at 
org.openide.filesystems.AbstractFolder.getFileObject
(AbstractFolder.java:421)
	at 
org.apache.tools.ant.module.wizards.properties.PropertiesFil
eProperty$PropertiesFileWizard.propertyChange
(PropertiesFileProperty.java:187)
	at 
java.beans.PropertyChangeSupport.firePropertyChange
(PropertyChangeSupport.java:252)
	at org.openide.NotifyDescriptor.firePropertyChange
(NotifyDescriptor.java:535)
	at org.openide.NotifyDescriptor.setValue
(NotifyDescriptor.java:428)
	at org.openide.WizardDescriptor.setValue
(WizardDescriptor.java:673)
	at 
org.netbeans.core.NbPresenter$ButtonListener.actionPerformed
(NbPresenter.java:933)
	at javax.swing.AbstractButton.fireActionPerformed
(AbstractButton.java:1767)
	at 
javax.swing.AbstractButton$ForwardActionEvents.actionPerform
ed(AbstractButton.java:1820)
	at 
javax.swing.DefaultButtonModel.fireActionPerformed
(DefaultButtonModel.java:419)
	at javax.swing.DefaultButtonModel.setPressed
(DefaultButtonModel.java:257)
	at 
javax.swing.plaf.basic.BasicButtonListener.mouseReleased
(BasicButtonListener.java:258)
	at java.awt.Component.processMouseEvent
(Component.java:5021)
	at java.awt.Component.processEvent
(Component.java:4818)
	at java.awt.Container.processEvent
(Container.java:1380)
	at java.awt.Component.dispatchEventImpl
(Component.java:3526)
	at java.awt.Container.dispatchEventImpl
(Container.java:1437)
	at java.awt.Component.dispatchEvent
(Component.java:3367)
	at java.awt.LightweightDispatcher.retargetMouseEvent
(Container.java:3214)
	at java.awt.LightweightDispatcher.processMouseEvent
(Container.java:2929)
	at java.awt.LightweightDispatcher.dispatchEvent
(Container.java:2859)
	at java.awt.Container.dispatchEventImpl
(Container.java:1423)
	at java.awt.Window.dispatchEventImpl
(Window.java:1566)
	at java.awt.Component.dispatchEvent
(Component.java:3367)
	at java.awt.EventQueue.dispatchEvent
(EventQueue.java:445)
[catch] at 
java.awt.EventDispatchThread.pumpOneEventForHierarchy
(EventDispatchThread.java:190)
	at 
java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:144)
	at 
java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:134)
	at java.awt.Dialog.show(Dialog.java:524)
	at org.netbeans.core.NbPresenter.superShow
(NbPresenter.java:688)
	at org.netbeans.core.NbPresenter.run
(NbPresenter.java:721)
	at org.openide.util.Mutex.doEventAccess
(Mutex.java:917)
	at org.openide.util.Mutex.readAccess(Mutex.java:161)
	at org.netbeans.core.NbPresenter.show
(NbPresenter.java:702)
	at 
org.openide.explorer.propertysheet.PropertyPanel$CustomizeLi
stener.sheetButtonClicked(PropertyPanel.java:1840)
	at 
org.openide.explorer.propertysheet.SheetButton.notifySheetBu
ttonListenersAboutClick(SheetButton.java:438)
	at 
org.openide.explorer.propertysheet.SheetButton$IL.mouseRelea
sed(SheetButton.java:509)
	at java.awt.AWTEventMulticaster.mouseReleased
(AWTEventMulticaster.java:227)
	at java.awt.Component.processMouseEvent
(Component.java:5021)
	at java.awt.Component.processEvent
(Component.java:4818)
	at java.awt.Container.processEvent
(Container.java:1380)
	at java.awt.Component.dispatchEventImpl
(Component.java:3526)
	at java.awt.Container.dispatchEventImpl
(Container.java:1437)
	at java.awt.Component.dispatchEvent
(Component.java:3367)
	at java.awt.LightweightDispatcher.retargetMouseEvent
(Container.java:3214)
	at java.awt.LightweightDispatcher.processMouseEvent
(Container.java:2929)
	at java.awt.LightweightDispatcher.dispatchEvent
(Container.java:2859)
	at java.awt.Container.dispatchEventImpl
(Container.java:1423)
	at java.awt.Window.dispatchEventImpl
(Window.java:1566)
	at java.awt.Component.dispatchEvent
(Component.java:3367)
	at java.awt.EventQueue.dispatchEvent
(EventQueue.java:445)
	at 
java.awt.EventDispatchThread.pumpOneEventForHierarchy
(EventDispatchThread.java:190)
	at 
java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:144)
	at java.awt.EventDispatchThread.pumpEvents
(EventDispatchThread.java:138)
	at java.awt.EventDispatchThread.pumpEvents
(EventDispatchThread.java:130)
	at java.awt.EventDispatchThread.run
(EventDispatchThread.java:98)
WARNING - the WizardDescriptor.Panel implementation 
org.apache.tools.ant.module.wizards.properties.AddProperties
Panel provides itself as the result of getComponent(). This 
can cause a clash when Component.isValid() is overridden. 
Please use a separate component class.
Comment 1 David Konecny 2002-07-19 15:12:16 UTC
Jesse, my interpretation of this error is that 
PropertiesFileProperty.PropertiesFileWizard listens on 
WizardDescriptor and is notified about button press sooner that the 
WizardDescriptor.Panel.storeSettings is called. That means that 
PropertiesIterator.PROP_FILE_NAME is not set.

It can be fixed by reading the values directly from the panels and not 
from the WizardDescriptor properties. Do you agree or is there some 
better solution.

Strange is that this bug appeared so suddenly.
Comment 2 Jesse Glick 2002-07-19 16:08:55 UTC
Surely storeSettings should be called before the Finish button press
action is processed? Sounds like a regression in WizardDescriptor to
me. If you can create a simple test case - and especially demonstrate
that it worked as expected in 3.3 - please attach & reassign to
openide/wizards.
Comment 3 Marek Grummich 2002-07-22 08:18:36 UTC
Target milestone was changed from '3.4' to TBD.
Comment 4 David Konecny 2002-07-22 09:32:04 UTC
Created attachment 6831 [details]
WizardDescTest.java
Comment 5 David Konecny 2002-07-22 09:42:58 UTC
Attached is the simple test case. Put it into root of your classpath, 
change compilation and execution to Internal and execute it. The 
wizard should appear. Press Finish button and check the output. In dev 
build (I expect that is not much different from release34 branch) 
Build 200207221004 the output is:

readSettings of panel: first panel
propertyChangeEvent=java.beans.PropertyChangeEvent[source=org.openide.
WizardDescriptor@152e01]
OK pressed - do something
storeSettings of panel: first panel

Important is that PropertyChange event OK_OPTION is received before 
the WizardDescriptor.Panel.storeSettings() was called.

If I execute the same program in dev build 200206140100, the output is 
as I would expect - the OK_OPTION notification is fired after the 
storeSettings() was called:

readSettings of panel: first panel
propertyChangeEvent=java.beans.PropertyChangeEvent[source=org.openide.
WizardDescriptor@258415]
storeSettings of panel: first panel
propertyChangeEvent=java.beans.PropertyChangeEvent[source=org.openide.
WizardDescriptor@258415]
OK pressed - do something

Please evaluate and let me know what you think about it. It looks like 
regression.
Comment 6 Jesse Glick 2002-07-22 10:46:13 UTC
Trung I think you also did some work on W.D. - maybe related? You seem
to have made the only relevant changes in that class during the time
period David mentions, in context of issue #12168 and issue #19213.
Comment 7 mslama 2002-07-24 17:51:44 UTC
Need to investigate what change causes this bug.
Comment 8 mslama 2002-08-02 16:24:48 UTC
Reason is that WizardDescriptor and NbPresenter listens to button:
first listener calls resetWizard -> storeSettings second listener
calls setValue -> propertyChange. Due to that (order in which events
from button to its listeners CANNOT be specified) it is not possible
to make sure that storeSettings is called BEFORE propertyChange.

Fact that it worked before was just incidental. One solution could be
to call WD.resetWizard from WD.setValue before super.setValue() ->
propertyChange is called. I will test this possibility.
Comment 9 mslama 2002-08-05 17:21:42 UTC
I attach diff for patch. It makes sure that storeSettings is called
before propertyChange with OK_OPTION is called. (However I do not know
if it does not break something else. Some tests for wizard would be
very helpfull.
Comment 10 mslama 2002-08-05 17:26:59 UTC
Created attachment 7018 [details]
Diff of suggested fix
Comment 11 mslama 2002-08-05 17:29:00 UTC
Passing to new owner
Comment 12 Jiri Rechtacek 2002-08-15 15:20:03 UTC
thanks marek, your patch is applied
Comment 13 Marian Mirilovic 2003-01-15 12:59:00 UTC
verified in [nb_dev](20030115)