This is an automated email from the ASF dual-hosted git repository.

jgauravgupta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new de94f12  Fixes creation of a Glassfish deployment descriptor (#3219)
de94f12 is described below

commit de94f12e898a66153123bf535a397b3202e7fcd3
Author: Gaurav Gupta <gaurav.gu...@payara.fish>
AuthorDate: Thu Jan 13 19:23:43 2022 +0530

    Fixes creation of a Glassfish deployment descriptor (#3219)
---
 .../modules/glassfish/eecommon/api/Utils.java      | 26 ++++------------------
 .../configbean/templates/SunDDVisualPanel.java     |  9 ++++----
 2 files changed, 9 insertions(+), 26 deletions(-)

diff --git 
a/enterprise/glassfish.eecommon/src/org/netbeans/modules/glassfish/eecommon/api/Utils.java
 
b/enterprise/glassfish.eecommon/src/org/netbeans/modules/glassfish/eecommon/api/Utils.java
index 89cf116..6b4953e 100644
--- 
a/enterprise/glassfish.eecommon/src/org/netbeans/modules/glassfish/eecommon/api/Utils.java
+++ 
b/enterprise/glassfish.eecommon/src/org/netbeans/modules/glassfish/eecommon/api/Utils.java
@@ -30,6 +30,8 @@ import org.netbeans.api.project.ProjectUtils;
 import org.netbeans.modules.glassfish.eecommon.api.config.J2eeModuleHelper;
 import org.netbeans.modules.j2ee.dd.api.common.RootInterface;
 import org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException;
+import org.netbeans.modules.j2ee.dd.api.ejb.EjbJar;
+import org.netbeans.modules.j2ee.dd.api.web.WebApp;
 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
 import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
 import org.openide.filesystems.FileObject;
@@ -177,30 +179,10 @@ public final class Utils {
     }
     
     public static FileObject getSunDDFromProjectsModuleVersion(J2eeModule mod, 
String sunDDFileName) {
-        FileObject retVal = null;
-        String suffix = "-java_ee_5/";
-        if (null != mod) {
-            String modVer = mod.getModuleVersion();
-            J2eeModule.Type t = mod.getType();
-            // ejb 2.0, 2.1, 3.0, 3.1
-            // web 2.3, 2.4, 2.5, 3.0
-            // appcli 1.3, 1.4, 5.0, 6.0
-            // ear 1.3, 1.4, 5, 6
-            if (modVer.equals("6") || modVer.equals("6.0") || 
modVer.endsWith("1.6") || modVer.equals("3.1")) {
-                suffix = "-java_ee/";
-            } else if (modVer.equals("3.0")) {
-                if (J2eeModule.Type.WAR.equals(t)) {
-                    suffix = "-java_ee/";
-                }
-            } else if (modVer.equals("1.4") || modVer.equals("2.4") || 
modVer.equals("2.1")) {
-                suffix = "-j2ee_1_4/";
-            } else if (modVer.equals("2.0") || modVer.equals("2.3") || 
modVer.equals("1.3")) {
-                suffix = "-j2ee_1_3/";
-            }
-        }
+        FileObject retVal;
+        String suffix = "-java_ee/";
         String resource = 
"org-netbeans-modules-glassfish-eecommon-ddtemplates" + suffix + sunDDFileName; 
// NOI18N
         retVal = FileUtil.getConfigFile(resource);
-        
         return retVal;
     }
     
diff --git 
a/enterprise/j2ee.sun.ddui/src/org/netbeans/modules/j2ee/sun/share/configbean/templates/SunDDVisualPanel.java
 
b/enterprise/j2ee.sun.ddui/src/org/netbeans/modules/j2ee/sun/share/configbean/templates/SunDDVisualPanel.java
index f034494..590f247 100644
--- 
a/enterprise/j2ee.sun.ddui/src/org/netbeans/modules/j2ee/sun/share/configbean/templates/SunDDVisualPanel.java
+++ 
b/enterprise/j2ee.sun.ddui/src/org/netbeans/modules/j2ee/sun/share/configbean/templates/SunDDVisualPanel.java
@@ -41,6 +41,7 @@ public final class SunDDVisualPanel extends JPanel {
     private String sunDDFileName;
     private File sunDDFile;
     private File sunDDLocation;
+    private static final String STANDARD_DD_NAME = "web.xml";
 
     public SunDDVisualPanel() {
         initComponents();
@@ -58,10 +59,10 @@ public final class SunDDVisualPanel extends JPanel {
         J2eeModule j2eeModule = provider.getJ2eeModule();
         sunDDFileName = 
getConfigFileName(j2eeModule,provider.getServerInstanceID());
 
-        // Calculate location:
-        sunDDFile = (sunDDFileName != null) ? 
j2eeModule.getDeploymentConfigurationFile(sunDDFileName) : null;
-        sunDDLocation = (sunDDFile != null) ? sunDDFile.getParentFile() : null;
-        
+        // Calculate location:        
+        sunDDLocation = 
j2eeModule.getDeploymentConfigurationFile(STANDARD_DD_NAME).getParentFile();
+        sunDDFile = (sunDDFileName != null) ? new File(sunDDLocation, 
sunDDFileName) : null;
+
         // initialize visual components
         textFileName.setText(sunDDFileName); // NOI18N
         
textProjectName.setText(ProjectUtils.getInformation(project).getDisplayName());

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to