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

mbien 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 dfae1d6dc1 Let ClassSource check for null elements in constructor.
     new 072dc0a232 Merge pull request #4389 from mbien/classsource-check-args
dfae1d6dc1 is described below

commit dfae1d6dc1c6aaedc227c0dd5f1c9e45e2e270b5
Author: Michael Bien <[email protected]>
AuthorDate: Sat Jul 16 09:29:59 2022 +0200

    Let ClassSource check for null elements in constructor.
    
    addToProjectClassPath() would fail later with a less useful stacktrace
    as observed in #4365.
---
 java/form/src/org/netbeans/modules/form/project/ClassSource.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/java/form/src/org/netbeans/modules/form/project/ClassSource.java 
b/java/form/src/org/netbeans/modules/form/project/ClassSource.java
index 924a247718..6af66303f9 100644
--- a/java/form/src/org/netbeans/modules/form/project/ClassSource.java
+++ b/java/form/src/org/netbeans/modules/form/project/ClassSource.java
@@ -26,7 +26,6 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import org.openide.filesystems.FileObject;
-import org.openide.filesystems.FileUtil;
 import org.openide.util.Lookup;
 
 /**
@@ -50,6 +49,9 @@ public final class ClassSource {
         this(className, entries, null);
     }
     public ClassSource(String className, Collection<? extends Entry> entries, 
String typeParameters) {
+        if (entries.contains(null)) {
+            throw new IllegalArgumentException("entries contains null entry: 
"+entries);
+        }
         this.className = className;
         this.entries = entries;
         this.typeParameters = typeParameters;
@@ -73,7 +75,7 @@ public final class ClassSource {
 
     /** Union of {@link ClassSource.Entry#getClasspath}. */
     public List<URL> getClasspath() {
-        List<URL> cp = new ArrayList<URL>();
+        List<URL> cp = new ArrayList<>();
         for (Entry entry : entries) {
             cp.addAll(entry.getClasspath());
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to