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.
Summary: | Cannot create a new freeform project inside of another project | ||
---|---|---|---|
Product: | projects | Reporter: | tomsve <tomsve> |
Component: | Ant Freeform | Assignee: | Jan Lahoda <jlahoda> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | jchalupa, jglick, mkubec, tzezula |
Priority: | P1 | Keywords: | REGRESSION |
Version: | 4.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 55533 | ||
Attachments: |
Demo project structure
Project structure demo Patch to fix this problem. Binary patch for release 4.1. Java/freeform that should fix the second problem. Patch. |
Description
tomsve
2005-04-30 09:22:56 UTC
If you want to help, please (1) calm down momentarily, (2) attach *complete and unambiguous* steps to reproduce the problem you are having from scratch - pristine IDE build, fresh user directory, and whatever data files / build scripts / Java sources / etc. that are needed to reproduce attached to the bug report, e.g. in a ZIP file, preferably in a minimal, stripped-down form. We need to be able to go through your steps in order and confirm that they work correctly in 4.1 beta (or 4.0 or something) and do not work in the 4.1 RC, and then determine why this is. If we can get that far, fixing it is likely to be easy. Also double-check your terminology and compare against the online help; for example, I have no idea what you mean by "undercatalog". Refer to visible UI elements ("Tools -> Java Platform Manager" etc.) for clarity. Do not say "create a project"; *I* don't know what kind of project you created, or what parameters you gave to it, and some of these details are probably critical. Specify which menu item you selected, which nodes you selected, which buttons you pressed, what text you typed in, what you saw happen at each stage. I know it's tedious but it makes a big difference. Note: we are very close to releasing 4.1 and only showstopper bugs can be fixed now, so even a day's delay may be significant. Note 2: whatever the bug here is (if it is a bug), I am sure there is some straightforward workaround you could use even if 4.1 gets released without it. The project creation wizards just create a few files on disk; there is nothing magical about it. Created attachment 21925 [details]
Demo project structure
I was first shocked and confused by your reply, but when reading my text again I do sound quite upset, which I was not aware of myself. I did not feel upset and I felt quite calm. Sorry. I have now attatched a zip file having the following content: nb-bug-demo/ build/ build.xml src/ nbproject/ (netbeans proj files) components/ comp1/ build/ build.xml src/ The bn-bug-demo catalog is a netbeans project with an existing Ant script. Now I want to add the comp1 catalog as another netbeans project with an existing Ant script. I do: - "File" menu -> "New Project ...". - Select "General" as "Category". - Select "Java project with existing Ant script". - Press "Next" button. - Select ".../nb-bug-demo/components/comp1" as "Location". - Select ".../nb-bug-demo/components/comp1/build/build.xml" as ant script. The "Next" and "Finnish" buttons are now disabled, and a text in blue color appears above the bottom buttons in the dialog. It says "Project folder is already owned by Netbeans project nb-bug-demo". That is what I meant by subcatalog. comp1 residens under nb-bug-demo which is a netbeans project. In my other project which I mentioned I have a lot project components that have their own ant scripts and own source catalogs and are their own Netbeans projects but riside in the filesystem under the main project catalog which is also a Netbeans project. This is a structure that Netbeans previously has had no problems with, and for 4.1rc1 it is only the create new project wizard that has the problem. If I go back to 4.0 and create the project, and then go back to 4.1rc1 is has no problem opening the project. The validation that the project catalog exists under another project catalog in the new project wizard did however seem very intentional, and not an accident, someone has put that validation there. That did scare me, I must addmit. I hope this makes it much clearer, and in general thanks to all the Netbeans developers for an in general excellent piece of software. /Tommy Created attachment 21926 [details]
Project structure demo
Oops! I though my first attachment failed, but apparently it didn't! So they are identical. /Tommy I can reproduce the problem. It is obviously not possible to create a new freeform project inside the directory hierarchy of some other existing project. I have modified the summary accordingly. In my opinion, this was caused by fix for issue #55533. I am attaching patch (against trunk) that hopefully fixes both this issue and issue #55533. Created attachment 21927 [details]
Patch to fix this problem.
So can anyone confirm this is a regression in 4.1 RC as suggested by tomsve? Fix for #55533 has been committed on 28 Feb 2005. I am able to create a freeform project inside a J2SE project in 4.0, but I cannot in 4.1RC1. Re. patch: 1. if ((p=FileOwnerQuery.getOwner(projectFolder.toURI()))!=null && projectFolder != null ... [BTW please put spaces around binary operators like = and !=] If projectFolder == null, wouldn't the first part of the clause have already thrown an NPE? So, no need to check for it. Put an assert projectFolder != null on the previous line if it should never be null (otherwise fix the if-statement to be false in case it is null). 2. Such an important fix requires a unit test - for both the problem that issue #55533 fixes (since Tomas did not write one at that time) and the regression its attempted fix caused - so it never gets broken again. Jan please attach some quick steps to reproduce for the benefit of QA. The fix looks OK to me if it works. I agree it is P1 and a candidate for the 4.1 release even at this late date. There should be a workaround - temporarily move the Ant script to some temp folder, create a freeform project around, then move the script and NB metadata back into its proper location - but this could be rather cumbersome and this involves basic project setup functionality. Oops, please disregard my comment "Jan please attach some quick steps to reproduce for the benefit of QA" - I somehow missed tomsve's steps to reproduce, which should be all we need (thanks for such quick turnaround!). The quick summary - originally, you were permitted to create a freeform project with either the project directory, or the external project location (if applicable), being identical to the project directory of another project (of whatever type) - which was not good. The patch for issue #55533 fixed this, but unintentionally also prevented you from creating a freeform project *in a subdirectory of* another project, which is harmless and should be allowed. Open question, a bit more obscure: say /src/something is an Ant project with a build.xml etc., and the user creates a freeform project in /src/something-nb with external project location /src/something (to keep /src/something free of NB-specific metadata), fine. Now the user *again* goes and tries to make a freeform project in /src/something-nb-2 with ext prj locn /src/something (for whatever reason). What will happen? With issue #55533 fix, the wizard will refuse, since /src/something is owned by /src/something-nb; after Jan's patch, I guess the wizard will permit it, since /src/something is not a project directory, at which point the two projects will conflict over /src/something... one of them will "win" and be marked as the owner. This, however, is I think a much less important problem (unlikely usage scenario); it could be fixed only with an impl of issue #53369, so that the wizard the second time around would know that /src/something was already explicitly owned by /src/something-nb. Perhaps file this problem separately (dep on #53369) and fix for 4.2. Milan, QA holds the keys now. We need a quick decision whether this can go into 4.1. Jan, please put the fix into trunk and send a notice to reviewers@netbeans.org. If QA is fine with it, the integration will have to go into release41 asap. Re patch: 1. The check for null is really useless. Re formating: I simply reused part of the original line without any big changes, incl. formatting. 2. Ok, will do a test for it. Quick steps to reproduce: 1. Create a new J2SE application "JavaApplication1" in directory ${TEST} (so there is ${TEST}/JavaApplication1). 2. Create directory ${TEST}/JavaApplication1/FreeForm1 and put an ant script into it. 3. Try to create a new freeform project with location ${TEST}/JavaApplication1/FreeForm1 - the wizard will not allow this. Please provide binary path against release41 branch. Thanks. Please provide also some info about what everything might be affected by this change, whether this patch is involved only in this particular situation or is involved in creating of any other project type. Thanks. Re risks: the patch affects all "freeform" projects, ie. Java Freeform, Web Freeform and EJB Freeform (and any other project type based on ant/freeform). It affects only the "Name and Location" panel of the wizard. Fixed in trunk. Diff: http://ant.netbeans.org/source/browse/ant/freeform/src/org/netbeans/modules/ant/freeform/ui/BasicProjectInfoPanel.java?r1=1.19&r2=1.20 Commit message: Checking in freeform/src/org/netbeans/modules/ant/freeform/ui/BasicProjectInfoPanel.java; /cvs/ant/freeform/src/org/netbeans/modules/ant/freeform/ui/BasicProjectInfoPanel.java,v <-- BasicProjectInfoPanel.java new revision: 1.20; previous revision: 1.19 done RCS file: /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/build.xml,v done Checking in freeform/test/unit/data/example-projects/freeforminside/build.xml; /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/build.xml,v <-- build.xml initial revision: 1.1 done RCS file: /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/FreeForm/build.xml,v done Checking in freeform/test/unit/data/example-projects/freeforminside/FreeForm/build.xml; /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/FreeForm/build.xml,v <-- build.xml initial revision: 1.1 done RCS file: /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/FreeForm/src/javaapplication1/Main.java,v done Checking in freeform/test/unit/data/example-projects/freeforminside/FreeForm/src/javaapplication1/Main.java; /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/FreeForm/src/javaapplication1/Main.java,v <-- Main.java initial revision: 1.1 done RCS file: /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/nbproject/project.xml,v done Checking in freeform/test/unit/data/example-projects/freeforminside/nbproject/project.xml; /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/nbproject/project.xml,v <-- project.xml initial revision: 1.1 done RCS file: /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/src/javaapplication1/Main.java,v done Checking in freeform/test/unit/data/example-projects/freeforminside/src/javaapplication1/Main.java; /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/src/javaapplication1/Main.java,v <-- Main.java initial revision: 1.1 done RCS file: /cvs/ant/freeform/test/unit/data/example-projects/simple3/build.xml,v done Checking in freeform/test/unit/data/example-projects/simple3/build.xml; /cvs/ant/freeform/test/unit/data/example-projects/simple3/build.xml,v <-- build.xml initial revision: 1.1 done RCS file: /cvs/ant/freeform/test/unit/data/example-projects/simple3/src/javaapplication1/Main.java,v done Checking in freeform/test/unit/data/example-projects/simple3/src/javaapplication1/Main.java; /cvs/ant/freeform/test/unit/data/example-projects/simple3/src/javaapplication1/Main.java,v <-- Main.java initial revision: 1.1 done RCS file: /cvs/ant/freeform/test/unit/src/org/netbeans/modules/ant/freeform/ui/BasicProjectInfoPanelTest.java,v done Checking in freeform/test/unit/src/org/netbeans/modules/ant/freeform/ui/BasicProjectInfoPanelTest.java; /cvs/ant/freeform/test/unit/src/org/netbeans/modules/ant/freeform/ui/BasicProjectInfoPanelTest.java,v <-- BasicProjectInfoPanelTest.java initial revision: 1.1 done Attaching binary patch org-netbeans-modules-ant-freeform.jar, place it into ${NETBEANS_INSTALL}/ide5/modules, replacing old file. Created attachment 21930 [details]
Binary patch for release 4.1.
The fix is only partial - other check whether sources aren't part of existing project is done on panel where user adds source roots to the project. And by the time of creating the project those source roots still belongs to the superproject and user cannot add such source roots. Workaround is *not to add* those source roots during creating freeform project but after the project is created from project properties, but I doubt anybody would guess that. Is this fixable? Yes, it is fixable. The wizard will need to extend the check when adding the source roots to check if the new source root is under projectLocation folder. if (FileOwnerQuery.getOwner (sourceRoot) != null && !FileUtil.isParentOf (projectLocation,srcRoot)) { //Show warning } Please provide binary patch for the fix. Is this fix only in the java freeform wizard or is it part of Java Freeform Project Properties? Re the second problem: it is in java/freeform. Affects both new Java freeform and Java freeform's project properties. IMO also affects all project types that use the Java Nature (Web+EJB). Created attachment 21931 [details]
Java/freeform that should fix the second problem.
*** Issue 58475 has been marked as a duplicate of this issue. *** Please, would you provide diff for the second fix. Please, file a new bug against java/freeform for the second problem. The proposed fix for this bug (cannot create a new freeform project inside directory hierarchy of another project) for release 4.1 is: http://ant.netbeans.org/source/browse/ant/freeform/src/org/netbeans/modules/ant/freeform/ui/BasicProjectInfoPanel.java?r1=1.19&r2=1.20 I will also attach complete patchset (including tests) for this problem. Tomas, Jesse could you please review the fix? Created attachment 21936 [details]
Patch.
Second problem is filed as #58490. Last patch looks OK to me. Tested and verified using provided binary patch against release41 RC2 build. The attached patch is good. Committed to release 4.1: Checking in freeform/src/org/netbeans/modules/ant/freeform/ui/BasicProjectInfoPanel.java; /cvs/ant/freeform/src/org/netbeans/modules/ant/freeform/ui/BasicProjectInfoPanel.java,v <-- BasicProjectInfoPanel.java new revision: 1.19.6.1; previous revision: 1.19 done Checking in freeform/test/unit/data/example-projects/freeforminside/build.xml; /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/build.xml,v <-- build.xml new revision: 1.1.2.1; previous revision: 1.1 done Checking in freeform/test/unit/data/example-projects/freeforminside/FreeForm/build.xml; /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/FreeForm/build.xml,v <-- build.xml new revision: 1.1.2.1; previous revision: 1.1 done Checking in freeform/test/unit/data/example-projects/freeforminside/FreeForm/src/javaapplication1/Main.java; /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/FreeForm/src/javaapplication1/Main.java,v <-- Main.java new revision: 1.1.2.1; previous revision: 1.1 done Checking in freeform/test/unit/data/example-projects/freeforminside/nbproject/project.xml; /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/nbproject/project.xml,v <-- project.xml new revision: 1.1.2.1; previous revision: 1.1 done Checking in freeform/test/unit/data/example-projects/freeforminside/src/javaapplication1/Main.java; /cvs/ant/freeform/test/unit/data/example-projects/freeforminside/src/javaapplication1/Main.java,v <-- Main.java new revision: 1.1.2.1; previous revision: 1.1 done Checking in freeform/test/unit/data/example-projects/simple3/build.xml; /cvs/ant/freeform/test/unit/data/example-projects/simple3/build.xml,v <-- build.xml new revision: 1.1.2.1; previous revision: 1.1 done Checking in freeform/test/unit/data/example-projects/simple3/src/javaapplication1/Main.java; /cvs/ant/freeform/test/unit/data/example-projects/simple3/src/javaapplication1/Main.java,v <-- Main.java new revision: 1.1.2.1; previous revision: 1.1 done Checking in freeform/test/unit/src/org/netbeans/modules/ant/freeform/ui/BasicProjectInfoPanelTest.java; /cvs/ant/freeform/test/unit/src/org/netbeans/modules/ant/freeform/ui/BasicProjectInfoPanelTest.java,v <-- BasicProjectInfoPanelTest.java new revision: 1.1.2.1; previous revision: 1.1 done |