You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ca...@apache.org on 2006/06/21 16:55:20 UTC

svn commit: r416001 - in /maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle: CheckstyleReport.java CheckstyleReportGenerator.java CheckstyleViolationCheckMojo.java VelocityTemplate.java

Author: carlos
Date: Wed Jun 21 07:55:19 2006
New Revision: 416001

URL: http://svn.apache.org/viewvc?rev=416001&view=rev
Log:
Checkstyle and PMD refactorings

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/CheckstyleReportGenerator.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java
    maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/VelocityTemplate.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=416001&r1=416000&r2=416001&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 Wed Jun 21 07:55:19 2006
@@ -551,8 +551,8 @@
     {
         String copyright;
         int currentYear = Calendar.getInstance().get( Calendar.YEAR );
-        if ( StringUtils.isNotEmpty( project.getInceptionYear() ) &&
-            !String.valueOf( currentYear ).equals( project.getInceptionYear() ) )
+        if ( StringUtils.isNotEmpty( project.getInceptionYear() )
+            && !String.valueOf( currentYear ).equals( project.getInceptionYear() ) )
         {
             copyright = project.getInceptionYear() + " - " + currentYear;
         }
@@ -688,14 +688,14 @@
             throw new MavenReportException( e.getMessage(), e );
         }
 
-        List URLs = new ArrayList( classPathStrings.size() );
+        List urls = new ArrayList( classPathStrings.size() );
 
         Iterator iter = classPathStrings.iterator();
         while ( iter.hasNext() )
         {
             try
             {
-                URLs.add( new File( ( (String) iter.next() ) ).toURL() );
+                urls.add( new File( ( (String) iter.next() ) ).toURL() );
             }
             catch ( MalformedURLException e )
             {
@@ -703,7 +703,7 @@
             }
         }
 
-        URLClassLoader projectClassLoader = new URLClassLoader( (URL[]) URLs.toArray( new URL[URLs.size()] ), null );
+        URLClassLoader projectClassLoader = new URLClassLoader( (URL[]) urls.toArray( new URL[urls.size()] ), null );
         checker.setClassloader( projectClassLoader );
 
         if ( moduleFactory != null )

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportGenerator.java?rev=416001&r1=416000&r2=416001&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportGenerator.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportGenerator.java Wed Jun 21 07:55:19 2006
@@ -34,8 +34,6 @@
 
 public class CheckstyleReportGenerator
 {
-    private static final String EOL = System.getProperty( "line.separator" );
-
     private Log log;
 
     private ResourceBundle bundle;
@@ -615,12 +613,9 @@
             AuditEvent event = (AuditEvent) events.next();
             SeverityLevel level = event.getSeverityLevel();
 
-            if ( getSeverityLevel() != null )
+            if ( ( getSeverityLevel() != null ) && !getSeverityLevel().equals( level ) )
             {
-                if ( !getSeverityLevel().equals( level ) )
-                {
-                    continue;
-                }
+                continue;
             }
 
             sink.tableRow();

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java?rev=416001&r1=416000&r2=416001&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java Wed Jun 21 07:55:19 2006
@@ -14,7 +14,6 @@
  * 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.
- *
  */
 
 import org.apache.maven.plugin.AbstractMojo;
@@ -122,8 +121,8 @@
         int eventType = xpp.getEventType();
         while ( eventType != XmlPullParser.END_DOCUMENT )
         {
-            if ( eventType == XmlPullParser.START_TAG && "error".equals( xpp.getName() ) &&
-                "error".equals( xpp.getAttributeValue( "", "severity" ) ) )
+            if ( eventType == XmlPullParser.START_TAG && "error".equals( xpp.getName() )
+                && "error".equals( xpp.getAttributeValue( "", "severity" ) ) )
             {
                 count++;
             }

Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/VelocityTemplate.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/VelocityTemplate.java?rev=416001&r1=416000&r2=416001&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/VelocityTemplate.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/VelocityTemplate.java Wed Jun 21 07:55:19 2006
@@ -79,13 +79,12 @@
      * @param outputFilename the file to be generated.
      * @param template       the velocity template to use.
      * @param context        the velocity context map.
-     * @throws ResourceNotFoundException if the template was not found.
-     * @throws VelocityException         if the
+     * @throws VelocityException if the template was not found or any other Velocity exception.
      * @throws MojoExecutionException
      * @throws IOException
      */
     public void generate( String outputFilename, String template, Context context )
-        throws ResourceNotFoundException, VelocityException, MojoExecutionException, IOException
+        throws VelocityException, MojoExecutionException, IOException
     {
         File f;