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 59240

Summary: Editable WAR (EAR, ...) file name
Product: javaee Reporter: zikmund <zikmund>
Component: Web ProjectAssignee: hmvictor
Severity: blocker CC: dkonecny, pjiricka, tomwheeler, vieiro
Priority: P3 Keywords: SIMPLEFIX
Version: 4.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: Patch for implementing this issue
Patch for implementing this issue (contains warning message for WAR-EAR projects).

Description zikmund 2005-05-25 13:52:30 UTC
Make WAR file name editable in project Properties -> it will be saved into property in nbproject/ file.
Comment 1 zikmund 2005-05-25 14:02:09 UTC
Based on nbusers request:
Comment 2 zikmund 2005-05-25 14:31:16 UTC
BTW: property should be${}
by default if the name will be editable in project Properties.
Comment 3 David Konecny 2008-04-09 01:19:02 UTC
*** Issue 65536 has been marked as a duplicate of this issue. ***
Comment 4 David Konecny 2008-04-09 01:27:03 UTC
*** Issue 67936 has been marked as a duplicate of this issue. ***
Comment 5 tomwheeler 2011-08-28 15:13:55 UTC
Victor is working on this with Antonio for the First Patch program, so I am adding myself to the cc list.
Comment 6 hmvictor 2011-08-30 05:03:11 UTC
This actions will be made to implement this:

* Make textfield for war name editable in org.netbeans.modules.web.project.ui.customizer.CustomizerWar class.
* Set the value of property to ${} in org.netbeans.modules.web.project.api.WebProjectUtilities.setUpProject

For testing: 

* A test for opening properties dialog and verify the text field for war name is editable.
* Verify that after setting up a project the value of is ${}
Comment 7 vieiro 2011-08-30 07:16:28 UTC
I'm adding myself to the CC list.
Comment 8 vieiro 2011-08-30 17:35:31 UTC

It seems WebProjectProperties (org/netbeans/modules/web/project/ui/customizer) has a WAR_NAME property, I think you can use that with another value without breaking backwards compatibility.

Anyway I think you should check for backwards compatibility (open a web project created with a previous version of NetBeans).

The plan seems ok to me.

Comment 9 hmvictor 2011-09-15 01:44:13 UTC
Created attachment 110766 [details]
Patch for implementing this issue
Comment 10 vieiro 2011-09-15 08:05:37 UTC

I've been taking a look at the patch and I think it's ready for integration.

Comment 11 Petr Jiricka 2011-09-15 09:02:05 UTC
Cc'ing David Konecny as the owner of the Web Project module.
Comment 12 David Konecny 2011-09-15 20:58:37 UTC
Hi guys,

thanks very much for the patch. I appreciate your effort!

Before reviewing patch there is one subtle issue I must mention: when a project A is used from a project B then project B stores file name of project A outcome; and renaming project A outcome will not be reflected in project B; unfortunately. In case of Web Project this means for example that if there is a EAR project which references Web Project foo then EAR will contain reference to {some.path}/foo.war. If we implement this issue and user renames foo.war to boo.war then EAR project reference will get broken. This problem is hard to prevent. Imagine for example that user may not even open EAR project in IDE or that single WAR is used from multiple EAR projects. At the moment NetBeans does not store any metadata about who is using who and therefore it is not possible to propagate war rename to all places where it might be used.

Having said that if we think that renaming WAR is very desirable feature then we could still go ahead with it and just warn user in UI if they changed WAR filename - a warning text would popup automatically saying something like "IF this WAR is used from an Enterprise Application then such application will need to be updated with a new WAR name as well" - although simplest way to do that in EAR would be to remove WAR module from EAR and re-add it.

What do you think?

I think that there is probably more WAR projects than WAR-in-EAR projects and so going ahead with this change and adding a warning might be a way to go.
Comment 13 hmvictor 2011-09-20 07:13:49 UTC
Created attachment 110897 [details]
Patch for implementing this issue (contains warning message for WAR-EAR projects).

A warning message is shown when the user changes the name of the WAR file.
Comment 14 David Konecny 2011-09-21 02:41:04 UTC
hmvictor, thanks for the patch. I had a look at it and it looks good.

One minor comment: should not change in set value of WebProjectProperties.WAR_EAR_NAME property to be based on ${WebProjectProperties.WAR_NAME}? Also the change in the same file one line above (newName to PropertyUtils.getUsablePropertyName(newName)) is consistent with code in WebProjectUtilities but I wonder why it was added to WebProjectUtilities in first place? Why should filename be restricted the same way Ant property names are? Perhaps somebody just reused already existing routine to make "safe" war filename? If I had to choose I would probably remove the restriction from code completely. On the other hand considering that nobody ever complained about this so far we can leave it as it is.

I'm happy with the patch and it is ready to go. Thank you! Can you push it to repo or do you need my help?
Comment 15 vieiro 2011-09-21 05:22:36 UTC
I think Victor (and the rest of NB First Patch mentorees) have no commit rights yet, so I'd appreciate if you could push it to the repo.

Thanks all,
Comment 16 David Konecny 2011-09-21 20:22:55 UTC
Thank you Victor for your patch! I commited it on your behalf into NB repository:
Comment 17 Quality Engineering 2011-09-22 14:48:45 UTC
Integrated into 'main-golden'
User: David Konecny <>
Log: #59240 - Editable WAR (EAR, ...) file name
patch contributed by Victor (! thank you
Comment 18 tomwheeler 2011-09-22 15:30:14 UTC
Victor, there is one last step. 

This change should be part of a nightly build by tomorrow.  Sometime after then, please download the latest build from the following URL:

And check to see that your change is now part of the IDE.  If so, please note
the build number (visible in Help->About from the IDE when you verify it) in
this issue and mark the status as VERIFIED.

Thanks again for your contribution to NetBeans!
Comment 19 hmvictor 2011-09-26 00:21:43 UTC
I verified is already included in the nightly builds.