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 221550 - AssertionError at org.netbeans.modules.web.clientproject.ui.wizard.ClientSideProjectWizardIterator$NewProjectWizard.instantiate
Summary: AssertionError at org.netbeans.modules.web.clientproject.ui.wizard.ClientSide...
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Project (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
: 216642 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-11-06 10:59 UTC by Vladimir Riha
Modified: 2012-11-15 02:48 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 194616


Attachments
stacktrace (4.76 KB, text/plain)
2012-11-06 10:59 UTC, Vladimir Riha
Details
stacktrace (4.65 KB, text/plain)
2012-11-06 11:29 UTC, Tomas Mysik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2012-11-06 10:59:47 UTC
Build: NetBeans IDE 7.3 Beta 2 (Build 201211052012)
VM: Java HotSpot(TM) Client VM, 23.6-b04, Java(TM) SE Runtime Environment, 1.7.0_10-ea-b11
OS: Linux

User Comments:
vriha: trying to create HTML project from online template (can provide link offline)




Stacktrace: 
java.lang.AssertionError
   at org.netbeans.modules.web.clientproject.ui.wizard.ClientSideProjectWizardIterator$NewProjectWizard.instantiate(ClientSideProjectWizardIterator.java:346)
   at org.netbeans.modules.web.clientproject.ui.wizard.ClientSideProjectWizardIterator.instantiate(ClientSideProjectWizardIterator.java:138)
   at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1044)
   at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:605)
   at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:439)
   at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:253)
Comment 1 Vladimir Riha 2012-11-06 10:59:49 UTC
Created attachment 127213 [details]
stacktrace
Comment 2 Vladimir Riha 2012-11-06 11:07:22 UTC
probably belongs here
Comment 3 Tomas Mysik 2012-11-06 11:29:10 UTC
Created attachment 127221 [details]
stacktrace

trying to reproduce issue 216642
Comment 4 Tomas Mysik 2012-11-06 11:34:56 UTC
Taking over. The Site Root apparently does not exist. Will investigate and fix.
Comment 5 Tomas Mysik 2012-11-06 11:38:19 UTC
*** Bug 216642 has been marked as a duplicate of this bug. ***
Comment 6 Tomas Mysik 2012-11-06 12:43:32 UTC
Fixed, however, when it happens, the error appears in the wizard just for a second and then disappears but this is a bug in the wizards I guess - Davide, can you confirm [1]? So, Láďo, please verify (simply use the "old" ZIP template with incorrect Site Root [/web]) and possibly report a bug against platform/Dialogs&Wizards.

Thanks.
[1] IOException is thrown from the instantiate() method

http://hg.netbeans.org/web-main/rev/ce0e5d477aa4
Comment 7 David Konecny 2012-11-06 21:18:37 UTC
Looks good to me. Thanks.
Comment 8 Quality Engineering 2012-11-07 03:44:14 UTC
Integrated into 'main-golden', will be available in build *201211070001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/ce0e5d477aa4
User: Tomas Mysik <tmysik@netbeans.org>
Log: #221550 - AssertionError at org.netbeans.modules.web.clientproject.ui.wizard.ClientSideProjectWizardIterator$NewProjectWizard.instantiate
Comment 9 Vladimir Riha 2012-11-07 14:21:32 UTC
Thanks, verified.

The wizzard issue is reported as issue #221647. If you press Finish again, IAE is thrown. Will this be "fixed" by fixing the 221647? Or should Finish button be disabled after the first unsuccessful attempt?


java.lang.IllegalArgumentException: Already a /home/vriha/Downloads/HTML5Application1/nbproject/project.xml@3fb357:1164f6e
	at org.netbeans.spi.project.support.ant.ProjectGenerator$1.run(ProjectGenerator.java:127)
	at org.netbeans.spi.project.support.ant.ProjectGenerator$1.run(ProjectGenerator.java:122)
	at org.openide.util.Mutex.writeAccess(Mutex.java:438)
	at org.netbeans.spi.project.support.ant.ProjectGenerator.createProject0(ProjectGenerator.java:122)
	at org.netbeans.spi.project.support.ant.ProjectGenerator.createProject(ProjectGenerator.java:103)
	at org.netbeans.modules.web.clientproject.util.ClientSideProjectUtilities.setupProject(ClientSideProjectUtilities.java:109)
...






Product Version: NetBeans IDE Dev (Build web-main-9137-on-20121107)
Java: 1.7.0_10-ea; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b11
System: Linux version 3.2.0-32-generic-pae running on i386; UTF-8; en_US (nb)
Comment 10 Tomas Mysik 2012-11-08 06:03:59 UTC
(In reply to comment #9)
> The wizzard issue is reported as issue #221647.

Thanks.

> If you press Finish again, IAE
> is thrown. Will this be "fixed" by fixing the 221647?

Yes, it should be.

> Or should Finish button
> be disabled after the first unsuccessful attempt?

This definitely should not do _every_ client of Wizards API (not sure if it is even possible); this should be done in the Wizards component directly.

> java.lang.IllegalArgumentException: Already a
> /home/vriha/Downloads/HTML5Application1/nbproject/project.xml@3fb357:1164f6e

The cause is that the nbproject directory has been created but the Site Root directory was not -> we throw IOException to the Wizards API - this is perfectly OK and should be done so. The result of course should be some error message in the wizard and all buttons disabled I guess (or closing the wizard and some error message displayed to the user? I don't know).

Thanks.
Comment 11 David Konecny 2012-11-08 21:05:35 UTC
(In reply to comment #10)
> The cause is that the nbproject directory has been created but the Site Root
> directory was not -> we throw IOException to the Wizards API - this is
> perfectly OK and should be done so. The result of course should be some error
> message in the wizard and all buttons disabled I guess (or closing the wizard
> and some error message displayed to the user? I don't know).

I think it depends on where an error happened. If the error happens in the instantiate() then we should go back to wizard only in case if we know that calling instantiate() second time can be successful. Otherwise it does not make sense to go back to wizard I think - if all buttons are disabled user cannot do there anything anyway.
Comment 12 Tomas Mysik 2012-11-09 05:22:32 UTC
(In reply to comment #11)
> I think it depends on where an error happened. If the error happens in the
> instantiate() then we should go back to wizard only in case if we know that
> calling instantiate() second time can be successful. Otherwise it does not make
> sense to go back to wizard I think - if all buttons are disabled user cannot do
> there anything anyway.

Yes, the exception is thrown in instantiate() and we have no possibility to show or hide the wizard - this happens in the Wizards component itself (at least I think so).
Comment 13 David Konecny 2012-11-12 02:34:26 UTC
Javadoc for InstantiatingIterator.instantiate() says that "if instantiation fails [that is IOException is thrown] then wizard remains open to enable correct values". So in our instantiate we should throw IOException only if it is possible to "correct values [and run instantiate again]". In case when we already created nbproject folder and half the files in instantiate method then we are in situation were we can:
* either go back to wizard and let user do there something and on second press of "Finish" button we should override all the files which we have created before; or
* not throw IOException at all and finish instantiate() without failure and show a dialog box to user saying "project creation failed because of ...."
Comment 14 Tomas Mysik 2012-11-12 09:01:07 UTC
In such case:

(In reply to comment #13)
> * not throw IOException at all and finish instantiate() without failure and
> show a dialog box to user saying "project creation failed because of ...."

I would prefer this option since the nbproject folder is already created and even if we delete it, the IDE could keep such project in its memory (not tested).

So reopening, I will fix it.
Comment 15 Tomas Mysik 2012-11-14 07:24:11 UTC
Fixed.

http://hg.netbeans.org/web-main/rev/92fe0b303a2b
Comment 16 Quality Engineering 2012-11-15 02:48:53 UTC
Integrated into 'main-golden', will be available in build *201211150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/92fe0b303a2b
User: Tomas Mysik <tmysik@netbeans.org>
Log: #221550 - AssertionError at org.netbeans.modules.web.clientproject.ui.wizard.ClientSideProjectWizardIterator$NewProjectWizard.instantiate