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 141beea101 Avoid NPE in ant module suite's "Project Properties"
dialog. "ProjectNav > some-module-suite > properties > Libraries" when
"<module-suite-dir>/nbproject/platform.properties" has "cluster.path=...
<maven-nbm-dir>/target/nbm/clusters/extra"
new 284ce10ea5 Merge pull request #4236 from
errael/NPEFixIfMavenExternalCluster
141beea101 is described below
commit 141beea101143f8e973c521d4dcf66a47e9be156
Author: Ernie Rael <[email protected]>
AuthorDate: Thu Jun 16 23:23:51 2022 -0700
Avoid NPE in ant module suite's "Project Properties" dialog.
"ProjectNav > some-module-suite > properties > Libraries"
when "<module-suite-dir>/nbproject/platform.properties"
has "cluster.path=... <maven-nbm-dir>/target/nbm/clusters/extra"
---
.../apisupport/project/universe/ClusterUtils.java | 33 ++++++++++++++--------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git
a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ClusterUtils.java
b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ClusterUtils.java
index e79c2c03e6..65360790f2 100644
---
a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ClusterUtils.java
+++
b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ClusterUtils.java
@@ -61,17 +61,32 @@ public final class ClusterUtils {
* @return Path to cluster dir or <tt>null</tt> if e.g. wrong type of
project.
*/
public static File getClusterDirectory(Project prj) {
- NbModuleProvider nbmp = prj.getLookup().lookup(NbModuleProvider.class);
+ File clusterDir =
getClusterDirectory(prj.getLookup().lookup(NbModuleProvider.class));
+ if (clusterDir != null) {
+ return clusterDir;
+ }
+ SuiteProvider sprv = prj.getLookup().lookup(SuiteProvider.class);
+ if (sprv != null) {
+ return sprv.getClusterDirectory();
+ }
+ return null;
+ }
+
+ /**
+ * Returns path to cluster dir for specified module provider.
+ * Path is returned even if it does not currently exist.
+ * @param prj module provider
+ * @return Path to cluster dir or <tt>null</tt> if e.g. wrong type of
project.
+ */
+ // TODO: might be useful as public method, this usage exists elsewhere
+ private static File getClusterDirectory(NbModuleProvider nbmp) {
if (nbmp != null) {
File jar = nbmp.getModuleJarLocation();
if (jar != null) {
+ // Is there a better way?
return jar.getParentFile().getParentFile();
}
}
- SuiteProvider sprv = prj.getLookup().lookup(SuiteProvider.class);
- if (sprv != null) {
- return sprv.getClusterDirectory();
- }
return null;
}
@@ -164,14 +179,8 @@ public final class ClusterUtils {
Project _prj = FileOwnerQuery.getOwner(Utilities.toURI(cd));
if (_prj != null) {
// Must be actual cluster output of a suite or standalone
module to qualify. See also: #168804, #180475
- SuiteProvider prov =
_prj.getLookup().lookup(SuiteProvider.class);
- if (prov != null && cd.equals(prov.getClusterDirectory())) {
+ if(cd.equals(getClusterDirectory(_prj))) {
prj = _prj;
- } else {
- NbModuleProvider prov2 =
_prj.getLookup().lookup(NbModuleProvider.class);
- if (prov2 != null && /* XXX is there a better way? */
cd.equals(prov2.getModuleJarLocation().getParentFile().getParentFile())) {
- prj = _prj;
- }
}
}
boolean enabled = (pathsWDC == null) ||
enabledPaths.contains(path);
---------------------------------------------------------------------
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