lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159581789


##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,53 @@ public RequestProcessor.Task fireProjectReload() {
         }
         return reloadTask;
     }
+    
+    private void reloadPossibleBrokenModules(MavenProject preceding, 
MavenProject p) {
+        // restrict to just poms that were marked as broken/incomplete.
+        if (!(MavenProjectCache.isFallbackproject(preceding) || 
+            
preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") 
!= Boolean.TRUE)) {
+            return;
+        }
+        // but do not cascade from projects, which are themselves broken.
+        if (MavenProjectCache.isFallbackproject(p)) {
+            return;
+        }
+        File basePOMFile = p.getFile().getParentFile();
+        for (String modName : p.getModules()) {
+            File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+            if (!modPom.exists() && modPom.isFile()) {
+                LOG.log(Level.FINE, "POM file {0} for module {1} does not 
exist", new Object[] { modPom, modName });
+                continue;
+            }
+            MavenProject child = MavenProjectCache.getMavenProject(modPom, 
true, false);
+            if (child == null) {
+                continue;
+            }
+            // the project may have more problems, more subtle, but now repair 
just total breakage
+            if (!MavenProjectCache.isFallbackproject(child)) {
+                LOG.log(Level.FINE, "Project for module {0} is not a fallback, 
skipping", modName);
+            }
+            FileObject dir = FileUtil.toFileObject(modPom.getParentFile());
+            if (dir == null) {
+                LOG.log(Level.FINE, "Project directory for {0} is not a 
FileObject", modName);
+                continue;
+            }
+            Project c;
+            try {
+                c = ProjectManager.getDefault().findProject(dir);
+                if (c == null) {
+                    LOG.log(Level.FINE, "Module {0} is not a project", 
modName);
+                }
+            } catch (IOException ex) {
+                LOG.log(Level.FINE, "Error getting module project {0} is not a 
project", modName);
+                LOG.log(Level.FINE, "Exception was: ", ex);
+                continue;
+            }
+            LOG.log(Level.INFO, "Recovering module {0}, pomfile {1}", new 
Object[] { modName, modPom });

Review Comment:
   wouldn't 
   LOG.log(Level.INFO, "Recovering module {0}, pomfile {1}", modName, modPom );
   be more readable?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
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