[ 
http://jira.codehaus.org/browse/MFINDBUGS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=265993#action_265993
 ] 

Thomas Traber edited comment on MFINDBUGS-142 at 5/8/11 3:14 AM:
-----------------------------------------------------------------

Hi Garvin. Thanks for tackling the bug. Unfortunately I also get a corrupted 
JAR file of the Findbugs plugin (fb-contrib) with the latest 2.3.3-SNAPSHOT. It 
seems that the "<<" operator in Groovy also uses Reader and Writers, but I 
could not verify this in reasonable time since the "documentation" of this 
operator (http://groovy.codehaus.org/JN2025-Streams) is quite poor. What I 
could verify faster is, that if I exchange the line

{code}
outputFile << is
{code}

by the lines of my original patch

{code}
final OutputStream os = new BufferedOutputStream(new FileOutputStream( 
outputFile ));
try {
    IOUtil.copy( is, os );
} finally {
    IOUtil.close(is);
    IOUtil.close(os);
}
{code}

then once again, everything works as intended.

      was (Author: traber):
    Hi Garvin. Thanks for tackling the bug. Unfortunately I also get a 
corrupted JAR file of the plugin with the latest 2.3.3-SNAPSHOT. It seems that 
the "<<" operator in Groovy also uses Reader and Writers, but I could not 
verify this in reasonable time since the "documentation" of this operator 
(http://groovy.codehaus.org/JN2025-Streams) is quite poor. What I could verify 
faster is, that if I exchange the line

{code}
outputFile << is
{code}

by the lines of my original patch

{code}
final OutputStream os = new BufferedOutputStream(new FileOutputStream( 
outputFile ));
try {
    IOUtil.copy( is, os );
} finally {
    IOUtil.close(is);
    IOUtil.close(os);
}
{code}

then once again, everything works as intended.
  
> Findbugs plugins from the classpath do not work
> -----------------------------------------------
>
>                 Key: MFINDBUGS-142
>                 URL: http://jira.codehaus.org/browse/MFINDBUGS-142
>             Project: Maven 2.x FindBugs Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3.2
>            Reporter: Thomas Traber
>            Assignee: Garvin LeClaire
>         Attachments: fb-plugin-with-pluginList.zip, 
> patch-against-findbugs-maven-plugin.txt, pom.xml
>
>
> If a Findbugs plugin on the classpath is specified using the pluginList 
> parameter of the Maven Findbugs plugin, then this plugin (it is a JAR file) 
> is copied into the target directory incorrectly and will not be processed by 
> findbugs.
> Some analysis:
> Plugins are made accessible to Findbugs by the FindBugsMojo as File by the 
> getResourceFile(String) method, which calls the ResourceManager method 
> getResourceAsFile(String, String). Everthing probably works fine if the 
> plugin is specified by a file name, but if the name is actually refering to a 
> classpath resource, then the DefaultResourceManager.getResourceAsFile(String, 
> String) method copies the resource with Readers and Writers which is of 
> course a bad idea for binary data. As a result the copied JAR file is not 
> readable by Findbugs and the plugin does not get processed.
> I consider the possibility to specify the Findbugs plugins by a classpath 
> resource very important, since it is the best way to share the plugin in 
> several projects.  The following snippets may help to see the principle idea:
> {code:xml|title=pom.xml}
>   ...
>   <build>
>     <extensions>
>       <!-- This makes the Findbugs plugin fb-contrib-*.jar available to the 
> maven-findbugs-plugin on the classpath. -->
>       <extension>
>          <groupId>com.mycompany</groupId>
>          <artifactId>maven-java-tools</artifactId>
>          <version>1.0.0</version>
>       </extension>
>     </extensions>
>     ....
>               <plugin>
>                 <groupId>org.codehaus.mojo</groupId>
>                 <artifactId>findbugs-maven-plugin</artifactId>
>                 <version>${findbugs-maven-plugin.version}</version>
>                 <configuration>
>                   <threshold>Low</threshold>
>                   <effort>Max</effort>
>                   
> <pluginList>com/mycompany/java/tools/findbugs/fb-contrib-4.6.0.jar</pluginList>
>                 </configuration>
>               </plugin>{code}
> PS: It would be nice to have the possibilities of the pluginList entries a 
> bit better documented in the site documentation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to