sdedic commented on a change in pull request #2944:
URL: https://github.com/apache/netbeans/pull/2944#discussion_r629559199



##########
File path: 
extide/gradle/src/org/netbeans/modules/gradle/loaders/LegacyProjectLoader.java
##########
@@ -142,38 +144,40 @@ private static GradleProject 
loadGradleProject(ReloadContext ctx, CancellationTo
             errors.clear();
             info = retrieveProjectInfo(goOnline, pconn, cmd, token, pl);
 
+            if (!info.getProblems().isEmpty()) {
+                errors.openNotification(
+                        TIT_LOAD_ISSUES(base.getProjectDir().getName()),
+                        TIT_LOAD_ISSUES(base.getProjectDir().getName()),
+                        
GradleProjectErrorNotifications.bulletedList(info.getProblems()));              
  
+            }
             if (!info.hasException()) {
                 if (!info.getProblems().isEmpty()) {
                     // If we do not have exception, but seen some problems the 
we mark the quality as SIMPLE
                     quality = SIMPLE;
-                    errors.openNotification(
-                            TIT_LOAD_ISSUES(base.getProjectDir().getName()),
-                            TIT_LOAD_ISSUES(base.getProjectDir().getName()),
-                            
GradleProjectErrorNotifications.bulletedList(info.getProblems()));
-
                 } else {
                     quality = ctx.aim;
                 }
             } else {
-                String problem = info.getGradleException();
-                String[] lines = problem.split("\n");
-                LOG.log(INFO, "Failed to retrieve project information for: 
{0}\nReason: {1}", new Object[] {base.getProjectDir(), problem}); //NOI18N
-                
errors.openNotification(TIT_LOAD_FAILED(base.getProjectDir().getName()), 
lines[0], problem);
-                return ctx.previous.invalidate(problem);
+                if (info.getProblems().isEmpty()) {
+                    String problem = info.getGradleException();
+                    String[] lines = problem.split("\n");
+                    LOG.log(INFO, "Failed to retrieve project information for: 
{0}\nReason: {1}", new Object[] {base.getProjectDir(), problem}); //NOI18N
+                    
errors.openNotification(TIT_LOAD_FAILED(base.getProjectDir().getName()), 
lines[0], problem);
+                    return ctx.previous.invalidate(problem);
+                } else {
+                    return 
ctx.previous.invalidate(info.getProblems().toArray(new String[0]));
+                }
             }
         } catch (GradleConnectionException | IllegalStateException ex) {
             LOG.log(FINE, "Failed to retrieve project information for: " + 
base.getProjectDir(), ex);
-            StringBuilder sb = new StringBuilder();
+            List<String> problems = new ArrayList<>();
             Throwable th = ex;
-            String separator = "";
             while (th != null) {
-                sb.insert(0, separator);
-                sb.insert(0, th.getMessage());
+                problems.add(th.getMessage());
                 th = th.getCause();
-                separator = "<br/>";
             }
-            errors.openNotification(TIT_LOAD_FAILED(base.getProjectDir()), 
ex.getMessage(), sb.toString());
-            return ctx.previous.invalidate(sb.toString());
+            errors.openNotification(TIT_LOAD_FAILED(base.getProjectDir()), 
ex.getMessage(), GradleProjectErrorNotifications.bulletedList(problems));

Review comment:
       The problems list is already html-format, so no newlines inside ... so 
further newline-split in `openNotification` has no effect. Good.




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

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