You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by sk...@apache.org on 2020/05/22 12:50:47 UTC

[netbeans] branch master updated: [NETBEANS-3575] Fixed ordering of j2ee.platform.classpath entires

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

skygo 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 b692048  [NETBEANS-3575] Fixed ordering of j2ee.platform.classpath entires
     new 3e2cf99  Merge pull request #1968 from GitHubb3R/feature/NETBEANS-3575
b692048 is described below

commit b692048e4305b7bb04b9a9f2aa1fd76ddc6b7d48
Author: Sik AndrĂ¡s Ferenc <si...@prolaninnolab.hu>
AuthorDate: Mon Feb 24 00:00:29 2020 +0100

    [NETBEANS-3575] Fixed ordering of j2ee.platform.classpath entires
    
    This commit modifies the ordering of entries in the "j2ee.platform.classpath" property value.
    Before this change those entries were ordered randomly which was inconvenient since version management systems picked it up as a modification.
    After this change classpath entries will be sorted in ascending order based on the absolute pathname of the files for the corresponding entries.
---
 .../modules/j2ee/common/ClasspathUtil.java         | 23 +++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/ClasspathUtil.java b/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/ClasspathUtil.java
index 16d1324..af2be10 100644
--- a/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/ClasspathUtil.java
+++ b/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/ClasspathUtil.java
@@ -24,7 +24,9 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
+import java.util.Comparator;
 import java.util.Enumeration;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -292,18 +294,33 @@ public class ClasspathUtil {
                 J2eePlatform j2eePlatformLocal = j2eePlatform != null ? j2eePlatform : Deployment.getDefault().getJ2eePlatform(j2eeModuleProvider.getServerInstanceID());
                 if (j2eePlatformLocal != null) {
                     try {
-                        return j2eePlatformLocal.getClasspathEntries(j2eeModuleProvider.getConfigSupport().getLibraries());
+                        File[] files = j2eePlatformLocal.getClasspathEntries(j2eeModuleProvider.getConfigSupport().getLibraries());
+                        sortClassPathEntries(files);
+                        return files;
                     } catch (ConfigurationException ex) {
                         LOGGER.log(Level.FINE, null, ex);
-                        return j2eePlatformLocal.getClasspathEntries();
+                        File[] files = j2eePlatformLocal.getClasspathEntries();
+                        sortClassPathEntries(files);
+                        return files;
                     }
                 }
             }
         }
         if (j2eePlatform != null) {
-            return j2eePlatform.getClasspathEntries();
+            File[] files = j2eePlatform.getClasspathEntries();
+            sortClassPathEntries(files);
+            return files;
         }
         return new File[]{};
     }
+    
+    private static void sortClassPathEntries(File[] files) {
+        Arrays.sort(files, new Comparator < File > () {
+            @Override
+            public int compare(File f1, File f2) {
+                return f1.getAbsolutePath().compareTo(f2.getAbsolutePath());
+            }
+        });
+    }
 
 }


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

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