adangel commented on code in PR #66:
URL: https://github.com/apache/maven-pmd-plugin/pull/66#discussion_r882725487


##########
src/main/java/org/apache/maven/plugins/pmd/exec/PmdExecutor.java:
##########
@@ -323,6 +307,26 @@ private PmdResult run() throws MavenReportException
         return new PmdResult( new File( request.getTargetDirectory(), 
"pmd.xml" ), request.getOutputEncoding() );
     }
 
+    /**
+     * Gets the errors as a single string. Each error is in its own line.
+     * @param withDetails if <code>true</code> then add the error details 
additionally (contains e.g. the stacktrace)
+     * @return the errors as string
+     */
+    private String getErrorsAsString( List<Report.ProcessingError> errors, 
boolean withDetails )
+    {
+        List<String> errorsAsString = new ArrayList<>( errors.size() );
+        for ( Report.ProcessingError error : errors )
+        {
+            errorsAsString.add( error.getFile() + ": " + error.getMsg() );
+            if ( withDetails )
+            {
+                errorsAsString.add( error.getDetail() );

Review Comment:
   That's fine, because we collect separate lines (errorsAsString is a 
`List<String>`) and later join them.



-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to