You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2006/08/21 17:51:02 UTC

svn commit: r433267 - in /maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle: CheckstyleReport.java ReportResource.java

Author: vsiveton
Date: Mon Aug 21 08:51:02 2006
New Revision: 433267

URL: http://svn.apache.org/viewvc?rev=433267&view=rev
Log:
MCHECKSTYLE-53: Cannot copy static resources on windows

o checked if the resource already exists or not

Modified:
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/ReportResource.java

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java?rev=433267&r1=433266&r2=433267&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java Mon Aug 21 08:51:02 2006
@@ -518,7 +518,7 @@
         }
         catch ( IOException e )
         {
-            throw new MavenReportException( "Unable to copy static resources." );
+            throw new MavenReportException( "Unable to copy static resources.", e );
         }
     }
 
@@ -1028,6 +1028,9 @@
         return ResourceBundle.getBundle( "checkstyle-report", locale, CheckstyleReport.class.getClassLoader() );
     }
 
+    /**
+     * @see org.apache.maven.reporting.AbstractMavenReport#canGenerateReport()
+     */
     public boolean canGenerateReport()
     {
         // TODO: would be good to scan the files here

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/ReportResource.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/ReportResource.java?rev=433267&r1=433266&r2=433267&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/ReportResource.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/ReportResource.java Mon Aug 21 08:51:02 2006
@@ -39,11 +39,15 @@
         this.outputDirectory = outputDirectory;
     }
 
-    public void copy( String resourceName )
-        throws IOException
+    public void copy( String resourceName ) throws IOException
     {
-        URL url = Thread.currentThread().getContextClassLoader().getResource( resourcePathBase + "/" + resourceName );
-        FileUtils.copyURLToFile( url, new File( outputDirectory, resourceName ) );
+        File resource = new File( outputDirectory, resourceName );
+        if ( ( resource != null ) && ( !resource.exists() ) )
+        {
+            URL url =
+                Thread.currentThread().getContextClassLoader().getResource( resourcePathBase + "/" + resourceName );
+            FileUtils.copyURLToFile( url, resource );
+        }
     }
 
     public File getOutputDirectory()