directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1021767 - in /directory/studio-plugin/trunk: ./ src/checkstyle/ src/main/java/org/apache/directory/studio/maven/plugins/
Date Tue, 12 Oct 2010 13:17:52 GMT
Author: seelmann
Date: Tue Oct 12 13:17:51 2010
New Revision: 1021767

URL: http://svn.apache.org/viewvc?rev=1021767&view=rev
Log:
Fixed Checkstyle, PMD, Findbugs issues

Added:
    directory/studio-plugin/trunk/src/checkstyle/
    directory/studio-plugin/trunk/src/checkstyle/suppressions.xml
Modified:
    directory/studio-plugin/trunk/pom.xml
    directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
    directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java
    directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java
    directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java
    directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java

Modified: directory/studio-plugin/trunk/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio-plugin/trunk/pom.xml?rev=1021767&r1=1021766&r2=1021767&view=diff
==============================================================================
--- directory/studio-plugin/trunk/pom.xml (original)
+++ directory/studio-plugin/trunk/pom.xml Tue Oct 12 13:17:51 2010
@@ -61,9 +61,9 @@
   </distributionManagement>
 
   <properties>
-    <distMgmtSiteUrl>scpexe://people.apache.org/www/directory.apache.org/studio-plugin/gen-docs/${version}</distMgmtSiteUrl>
+    <distMgmtSiteUrl>scpexe://people.apache.org/www/directory.apache.org/studio-plugin/gen-docs/${project.version}</distMgmtSiteUrl>
     <skin.version>1.0.2</skin.version>
-    <org.apache.directory.buildtools.directory-checkstyle.version>0.1-SNAPSHOT</org.apache.directory.buildtools.directory-checkstyle.version>
+    <org.apache.directory.buildtools.checkstyle-configuration.version>0.1</org.apache.directory.buildtools.checkstyle-configuration.version>
   </properties>
 
   <build>
@@ -74,8 +74,8 @@
         <dependencies>
           <dependency>
             <groupId>org.apache.directory.buildtools</groupId>
-            <artifactId>directory-checkstyle</artifactId>
-            <version>${org.apache.directory.buildtools.directory-checkstyle.version}</version>
+            <artifactId>checkstyle-configuration</artifactId>
+            <version>${org.apache.directory.buildtools.checkstyle-configuration.version}</version>
           </dependency>
         </dependencies>
       </plugin>
@@ -193,6 +193,11 @@
       <artifactId>plexus-utils</artifactId>
       <version>2.0.5</version>
     </dependency>
+    <dependency>
+      <groupId>findbugs</groupId>
+      <artifactId>annotations</artifactId>
+      <version>1.0.0</version>
+    </dependency>
 
     <!-- Test -->
     <dependency>
@@ -383,6 +388,11 @@
             <exclude>**/*.iws</exclude>
             <!-- MANIFEST_MF_EXCLUDES -->
             <exclude>**/MANIFEST.MF</exclude>
+            <!-- Files used for testing -->
+            <exclude>src/test/resources/unit/basic-clean-test/.externalToolBuilders</exclude>
+            <exclude>src/test/resources/unit/basic-clean-test/maven-eclipse.xml</exclude>
+            <exclude>src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/repo-marker.txt</exclude>
+            <exclude>src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/**</exclude>
           </excludes>
         </configuration>
       </plugin>

Added: directory/studio-plugin/trunk/src/checkstyle/suppressions.xml
URL: http://svn.apache.org/viewvc/directory/studio-plugin/trunk/src/checkstyle/suppressions.xml?rev=1021767&view=auto
==============================================================================
--- directory/studio-plugin/trunk/src/checkstyle/suppressions.xml (added)
+++ directory/studio-plugin/trunk/src/checkstyle/suppressions.xml Tue Oct 12 13:17:51 2010
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<!DOCTYPE suppressions PUBLIC
+    "-//Puppy Crawl//DTD Suppressions 1.1//EN"
+    "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
+
+<suppressions>
+    <!-- Javadoc tags (@goal, @execute, etc.) in Mojos -->
+    <suppress files="org.apache.directory.studio.maven.plugins.*Mojo" checks="[A-Za-z0-9]"
/>
+</suppressions>
+

Modified: directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
URL: http://svn.apache.org/viewvc/directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java?rev=1021767&r1=1021766&r2=1021767&view=diff
==============================================================================
--- directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
(original)
+++ directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
Tue Oct 12 13:17:51 2010
@@ -162,7 +162,7 @@ public abstract class AbstractStudioMojo
      * @required
      * @readonly
      */
-    private MavenSession session;
+    protected MavenSession session;
 
 
     /**
@@ -180,7 +180,10 @@ public abstract class AbstractStudioMojo
         try
         {
             getLog().info( "Unpacking " + file + " to\n                 " + location );
-            location.mkdirs();
+            if ( !location.mkdirs() )
+            {
+                throw new IOException( "Failed to create directory " + location );
+            }
             UnArchiver unArchiver = archiverManager.getUnArchiver( file );
             unArchiver.setSourceFile( file );
             unArchiver.setDestDirectory( location );
@@ -543,11 +546,17 @@ public abstract class AbstractStudioMojo
             {
                 if ( file.isDirectory() )
                 {
-                    deleteDirectory( file );
+                    if ( !deleteDirectory( file ) )
+                    {
+                        return false;
+                    }
                 }
                 else
                 {
-                    file.delete();
+                    if ( !file.delete() )
+                    {
+                        return false;
+                    }
                 }
             }
         }

Modified: directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java
URL: http://svn.apache.org/viewvc/directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java?rev=1021767&r1=1021766&r2=1021767&view=diff
==============================================================================
--- directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java
(original)
+++ directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java
Tue Oct 12 13:17:51 2010
@@ -21,6 +21,7 @@ package org.apache.directory.studio.mave
 
 
 import java.io.File;
+import java.io.IOException;
 
 import org.apache.maven.plugin.MojoExecutionException;
 
@@ -38,9 +39,9 @@ import org.apache.maven.plugin.MojoExecu
 public class StudioCleanMojo extends AbstractStudioMojo
 {
 
-    private final String MAVEN_ECLIPSE_XML = "maven-eclipse.xml";
-    private final String EXTERNAL_TOOL_BUILDERS_DIR = ".externalToolBuilders";
-    private final String META_INF = "META-INF";
+    private static final String MAVEN_ECLIPSE_XML = "maven-eclipse.xml";
+    private static final String EXTERNAL_TOOL_BUILDERS_DIR = ".externalToolBuilders";
+    private static final String META_INF = "META-INF";
 
 
     public void execute() throws MojoExecutionException
@@ -61,7 +62,10 @@ public class StudioCleanMojo extends Abs
         {
             File file = new File( project.getBasedir(), MAVEN_ECLIPSE_XML );
             getLog().info( "Deleting " + file );
-            file.delete();
+            if ( !file.delete() )
+            {
+                throw new IOException( "Failed to delete file " + file );
+            }
             file = new File( project.getBasedir(), EXTERNAL_TOOL_BUILDERS_DIR );
             getLog().info( "Deleting " + file );
             deleteDirectory( file );

Modified: directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java
URL: http://svn.apache.org/viewvc/directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java?rev=1021767&r1=1021766&r2=1021767&view=diff
==============================================================================
--- directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java
(original)
+++ directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java
Tue Oct 12 13:17:51 2010
@@ -165,8 +165,10 @@ public class StudioEclipseMojo extends A
         {
             final File copyDir = new File( project.getBasedir(), libraryPath );
 
-            if ( !copyDir.exists() )
-                copyDir.mkdirs();
+            if ( !copyDir.exists() && !copyDir.mkdirs() )
+            {
+                throw new IOException( "Failed to create directory " + copyDir );
+            }
 
             for ( Artifact artifact : list )
             {
@@ -270,13 +272,16 @@ public class StudioEclipseMojo extends A
 
 
     /**
-     * remove ${basedir}/maven-eclipse.xml
+     * Remove ${basedir}/maven-eclipse.xml
+     * @throws IOException if the file can't be deleted
      */
-    void removeMavenEclipseXml()
+    void removeMavenEclipseXml() throws IOException
     {
         File file = new File( project.getBasedir(), "maven-eclipse.xml" );
-        if ( file.exists() )
-            file.delete();
+        if ( file.exists() && !file.delete() )
+        {
+            throw new IOException( "Failed to delete file " + file );
+        }
     }
 
 

Modified: directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java
URL: http://svn.apache.org/viewvc/directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java?rev=1021767&r1=1021766&r2=1021767&view=diff
==============================================================================
--- directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java
(original)
+++ directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java
Tue Oct 12 13:17:51 2010
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.studio.maven.plugins;
 
@@ -32,14 +32,14 @@ import org.apache.maven.plugin.MojoExecu
 /**
  * Prepares for jar: Copy artifacts nonscoped "provided" to
  * ${project.build.outputDirectory}/libraryPath
- * 
+ *
  * @goal prepare-jar-package
  * @phase process-resources
  * @aggregator
  * @requiresProject
  * @requiresDependencyResolution runtime
  * @since 1.0
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class StudioPrepareJarPackageMojo extends AbstractStudioMojo
@@ -47,11 +47,12 @@ public class StudioPrepareJarPackageMojo
 
     /**
      * Directory containing the classes.
-     * 
+     *
      * @parameter expression="${project.build.outputDirectory}"
      * @readonly
      * @required
      */
+    @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="UWF_UNWRITTEN_FIELD")
     private File classesOutDir;
 
 
@@ -75,7 +76,7 @@ public class StudioPrepareJarPackageMojo
 
     /**
      * Copy artifacts to ${basedir}/lib
-     * 
+     *
      * @param list
      * @throws IOException
      */
@@ -86,8 +87,10 @@ public class StudioPrepareJarPackageMojo
         {
             final File copyDir = new File( classesOutDir, libraryPath );
 
-            if ( !copyDir.exists() )
-                copyDir.mkdirs();
+            if ( !copyDir.exists() && !copyDir.mkdirs() )
+            {
+                throw new IOException( "Failed to create directory " + copyDir );
+            }
 
             for ( Artifact artifact : list )
             {

Modified: directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java
URL: http://svn.apache.org/viewvc/directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java?rev=1021767&r1=1021766&r2=1021767&view=diff
==============================================================================
--- directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java
(original)
+++ directory/studio-plugin/trunk/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java
Tue Oct 12 13:17:51 2010
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.studio.maven.plugins;
 
@@ -33,12 +33,12 @@ import org.apache.maven.shared.osgi.Mave
 /**
  * Add/Replace a file within a given eclipse artifact at a specific location
  * (zip or jar file)
- * 
+ *
  * @goal replace-file-in-eclipse-artifact
  * @requiresProject
  * @requiresDependencyResolution runtime
  * @since 1.0
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class StudioReplaceFileInJarMojo extends AbstractStudioMojo
@@ -48,7 +48,7 @@ public class StudioReplaceFileInJarMojo 
      * Collection of ArtifactItems to work on. (ArtifactItem contains groupId,
      * artifactId, version, type, classifier, location, destFile, markerFile and
      * overwrite.) See "Usage" and "Javadoc" for details.
-     * 
+     *
      * @parameter
      * @required
      * @since 1.0
@@ -57,7 +57,7 @@ public class StudioReplaceFileInJarMojo 
 
     /**
      * FinalName of the jar file
-     * 
+     *
      * @parameter
      * @required
      * @since 1.0
@@ -66,7 +66,7 @@ public class StudioReplaceFileInJarMojo 
 
     /**
      * Location of the file.
-     * 
+     *
      * @parameter expression="${project.build.directory}"
      * @required
      * @since 1.0
@@ -75,11 +75,12 @@ public class StudioReplaceFileInJarMojo 
 
     /**
      * Tmp work directory for this plugin
-     * 
+     *
      * @parameter expression="${project.build.directory}/ReplaceFileInJarMojo/"
      * @required
      * @readonly
      */
+    @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="UWF_UNWRITTEN_FIELD")
     private String pluginWorkDir;
 
 



Mime
View raw message