Community
Participate
Working Groups
When a EJB project and its EJB client jar project have different source folders (e.g. EJB project has ejbModule, client has scr), and a session bean is created, the interfaces are not created in the existing source folder, but a source folder with the same name as the source folder in the EJB project is created, leaving the EJB client project with two source folders. Steps to recreate: 1. Import the attached EAR file. Note that the EJB project has one scource folder: ejbModule, and the client has one source folder: src. Also note that both folders have java files. 2. Create a new session bean, including local and/or remote business interfaces. 3. Note that a new source folder (ejbModule) is created in the client project, instead of using the existing folder. Now, the EJB client project has two different source folders.
Created attachment 209936 [details] EAR for recreating bug
Created attachment 209937 [details] Proposed patch for 3.3.2 and 3.4 This patch uses existing source folder in ejb client jar if a source folder with the same name as the one uses in the EJB project does not exist.
Any though on this one?
Roberto, sorry for the delay. This bug is a good catch and worth fixing it for Indigo. I have one comment on the patch. On line 144 you call "folder.exists" and a few lines later you check "folder == null". It seems like the order is not correct. If folder is null then line 144 will throw NPE. Do you agree?
Well, not completely :D The call to getClientSourceFolder() will never return null, so the call to "if (!folder.exists()){ " should be safe. The method getFirstJavaSourceFolderInClientJar() will return null in the case the project does not have a source folder, so that is why I check if the folder in null this time, and if it is, then the folder will be created. But Carl found a small optimization to the code, that consists on putting the check for null inside the first if, and not at the same level. Attaching a new patch. Kaloyan, would you mind reviewing it again after these comments? Thank you!
Created attachment 210120 [details] Proposed patch for 3.3.2 and 3.4 (version 2)
OK. Now I understand. Thank you for the detailed explanation.
Code committed to HEAD and R3_3_maintenance for WTP 3.4 and 3.3.2. Resolving bug.