[ 
https://issues.apache.org/jira/browse/MNG-7393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17480003#comment-17480003
 ] 

Benjamin Marwell commented on MNG-7393:
---------------------------------------

You should know better than me that this is not a good idea, especially in this 
case. A {{MojoExecutionException}} and/or {{MavenReportException}} (wrapped 
around the {{{}IOException{}}}) is much better handled and printed.

I am not really sure what to make from your comment. Yes, I know I *could* 
throw a {{{}RuntimeException{}}}. But as you could have guessed from the fact 
that I created this issue in the first place, I sincerely think changing the 
API is a cleaner solution here. ;)

> API change: let `canGenerateReport` throw an Exception
> ------------------------------------------------------
>
>                 Key: MNG-7393
>                 URL: https://issues.apache.org/jira/browse/MNG-7393
>             Project: Maven
>          Issue Type: Improvement
>            Reporter: Benjamin Marwell
>            Priority: Major
>
> Hi everyone,
> the `{{{}AbstractReportMojo{}}}` declares a method 
> `{{{}canGenerateReport(){}}}`.
> However, it is unable to throw any exceptions. Not even {{MojoExecutionEx}} 
> or {{{}MavenReportEx{}}}, which is most unfortunate.
> It is being used twice:
> Once in {{execute() throws MojoExEx}}
> and in
> {{generate() throws MavenReportEx}} (and is called by execute()).
> This way, there is no way for reporting plugins to scan for files, because 
> {{FileUtils::getFiles}} DOES throw a {{{}IOException{}}}, which then cannot 
> be wrapped. However, the {{IOException}} from that method is useless anyway, 
> because it is never declared in any methods it calls.
> Therefore please consider:
>  * Declaring any Exception on `{{{}canGenerateReports(){}}}`
>  * Removing the declared {{IOException}} in PlexusUtils ([PR 
> exists|https://github.com/codehaus-plexus/plexus-utils/issues/180]) and 
> Maven-Utils (issue: tbd).
> Thanks!
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to