You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2011/05/01 16:41:23 UTC
svn commit: r1098343 -
/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/resource/loader/ProjectResourceLoader.java
Author: dennisl
Date: Sun May 1 14:41:23 2011
New Revision: 1098343
URL: http://svn.apache.org/viewvc?rev=1098343&view=rev
Log:
[MCHANGES-210] Update to Java 5
- Start using generics in ProjectResourceLoader
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/resource/loader/ProjectResourceLoader.java
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/resource/loader/ProjectResourceLoader.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/resource/loader/ProjectResourceLoader.java?rev=1098343&r1=1098342&r2=1098343&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/resource/loader/ProjectResourceLoader.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/resource/loader/ProjectResourceLoader.java Sun May 1 14:41:23 2011
@@ -45,14 +45,14 @@ public class ProjectResourceLoader
/**
* The paths to search for templates.
*/
- private List paths = null;
+ private List<String> paths = null;
/**
* Used to map the path that a template was found on
* so that we can properly check the modification
* times of the files.
*/
- private Hashtable templatePaths = new Hashtable();
+ private Hashtable<String,String> templatePaths = new Hashtable<String,String>();
public void init( ExtendedProperties configuration )
{
@@ -65,7 +65,7 @@ public class ProjectResourceLoader
rsvc.getLog().info( "path :" + path );
- paths = new ArrayList();
+ paths = new ArrayList<String>();
paths.add( path );
@@ -73,7 +73,7 @@ public class ProjectResourceLoader
for ( int i = 0; i < sz; i++ )
{
- rsvc.getLog().info( "ProjectResourceLoader : adding path '" + (String) paths.get( i ) + "'" );
+ rsvc.getLog().info( "ProjectResourceLoader : adding path '" + paths.get( i ) + "'" );
}
rsvc.getLog().info( "ProjectResourceLoader : initialization complete." );
}
@@ -123,12 +123,10 @@ public class ProjectResourceLoader
}
// MCHANGES-118 adding the basedir path
- paths.add( rsvc.getApplicationAttribute( "baseDirectory" ) );
+ paths.add( (String) rsvc.getApplicationAttribute( "baseDirectory" ) );
- int size = paths.size();
- for ( int i = 0; i < size; i++ )
+ for ( String path : paths )
{
- String path = (String) paths.get( i );
InputStream inputStream = findTemplate( path, template );
if ( inputStream != null )
@@ -203,12 +201,12 @@ public class ProjectResourceLoader
boolean modified = true;
String fileName = resource.getName();
- String path = (String) templatePaths.get( fileName );
+ String path = templatePaths.get( fileName );
File currentFile = null;
for ( int i = 0; currentFile == null && i < paths.size(); i++ )
{
- String testPath = (String) paths.get( i );
+ String testPath = paths.get( i );
File testFile = new File( testPath, fileName );
if ( testFile.canRead() )
{
@@ -246,7 +244,7 @@ public class ProjectResourceLoader
public long getLastModified( Resource resource )
{
- String path = (String) templatePaths.get( resource.getName() );
+ String path = templatePaths.get( resource.getName() );
File file = new File( path, resource.getName() );
if ( file.canRead() )