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 9326 - TemplateWizard exits on Finish even if there is an IOException
Summary: TemplateWizard exits on Finish even if there is an IOException
Status: CLOSED DUPLICATE of bug 8858
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: All All
: P3 normal (vote)
Assignee: David Strupl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-01-31 18:27 UTC by Jeri Lockhart
Modified: 2008-12-22 17:52 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeri Lockhart 2001-01-31 18:27:18 UTC
The TemplateWizard, which is launched from the File/New menu,  exits when the
Finish button is pressed even if an IOException has been thrown from a
DataObject handleCreateFromTemplate().  The TemplateWizard should stay open to
allow the user to correct the problem, which may be an illegal name.  An example
of this is Templates/Beans/Bean.  If you enter an illegal name on the "New From
Template - Target Location" dialog (screen 2 of the wizard), then click Finish,
you get an IOException message, but the wizard closes.  To correct the name you
must launch the wizard again.
Comment 1 Jesse Glick 2001-01-31 18:54:59 UTC
I think you can do something with IllegalArgumentException here instead? ...but
not sure.
Comment 2 David Strupl 2001-02-21 09:38:57 UTC
Please read this:
http://www.netbeans.org/www-nbdev/msg03185.html
IOException should happen only when e.g. you run the wizard and you add the file
with same name from outside the ide, or someone unmount your disk or
similar strange error. The wizard author is responsible for checking the name
and can throw IllegalArgumentException. Marking this as invalid, if you don't
agree please comment and reopen. Thanks.
Comment 3 Jeri Lockhart 2001-02-21 22:42:11 UTC
The solution described will require implementing an Iterator.  I have a 
situation in which  I am using the default iterator. It seems to me like 
overkill to have to implement an Iterator for a simple wizard that has only the 
one name panel just to do a simple validation.  My suggestion is to modify the 
default iterator to validate basic types, namely, valid Java identifiers.  The 
default iterator would need to know which basic type to validate for.  Please 
look at the wizards for Java classes and Beans.  In both cases, if the user 
presses Finish after entering a bad name (a name that is not a valid Java 
identifier), they get an IOException thrown from handleCreateFromTemplate(), and 
the wizard exits before they can correct the name.    There are dozens of other 
similar examples:  AWT Forms (Applet, Dialog, Frame, Panel), Beans (Bean, 
BeanInfo, BeanInfoNoIcon, Customizer, PropertyEditor), CORBA (POA-Adapter 
Activate, POA-ServantActivate, POA-ServantLocate, Client Main, Server Main), 
Classes (Applet, Class, Empty, Exception, Interface, JApplet, Main), Sample Form 
(Application, MDI Application, OK/Cancel Dialog)....and many more. 

Comment 4 Svata Dedic 2001-02-22 06:53:11 UTC
Also note, that if an IOException is thrown from instantiate() of the iterator
(or createFromTemplate of a DataObject), some garbage may be left in the target
directory.
Comment 5 Jesse Glick 2001-02-22 09:52:36 UTC
Svata has a point, undoing the effects after IOException is thrown is not
reasonable, it should be caught before then. The Java module provides a default
iterator for all JavaDataObject's, I believe, so why can't it throw
IllegalArgumentException if the name is invalid? Agreed it is unreasonable for
every *.java template to do this specially, but java module should I think.

Cf. also an older RFE for a DataObject to be able to declare an iterator type
without using file attributes.
Comment 6 David Strupl 2001-03-05 14:12:07 UTC
I have marked this as duplicate of #8858 because
1. we agreed that IOException is not the main problem
2. there should be a way how to validate the name without the need to write
/specify the iterator (and this is described in 8858).

So again - if you think that solving 8858 does not solve this issue please
reopen this one. I think (as Jesse pointed out) the problem is not in
IOException -- it is in not being able to create a "default" iterator.

*** This issue has been marked as a duplicate of 8858 ***
Comment 7 Quality Engineering 2003-07-01 15:56:14 UTC
Resolved for 3.4.x or earlier, no new info since then -> verified
Comment 8 Quality Engineering 2003-07-01 16:14:59 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.