dion        02/05/27 02:10:33

  Modified:    src/java/org/apache/maven DVSLPathTool.java MavenUtils.java
                        ProjectVerifier.java ProjectResolver.java
                        ProjectProperties.java PackageProjectMap.java
                        ProjectResolverSource.java
  Log:
  Fix checkstyle issues
  
  Revision  Changes    Path
  1.8       +4 -4      
jakarta-turbine-maven/src/java/org/apache/maven/DVSLPathTool.java
  
  Index: DVSLPathTool.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/DVSLPathTool.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DVSLPathTool.java 27 May 2002 07:59:15 -0000      1.7
  +++ DVSLPathTool.java 27 May 2002 09:10:33 -0000      1.8
  @@ -68,7 +68,7 @@
    * 
    * @author <a href="mailto:[EMAIL PROTECTED]";>Pete Kazmier</a>
    * @author <a href="[EMAIL PROTECTED]">Vincent Massol</a>
  - * @version $Id: DVSLPathTool.java,v 1.7 2002/05/27 07:59:15 vmassol Exp $
  + * @version $Id: DVSLPathTool.java,v 1.8 2002/05/27 09:10:33 dion Exp $
    */
   public class DVSLPathTool
   {
  @@ -273,10 +273,10 @@
        *
        * @param absoluteFileName the absolute file name to transform
        * @return the shortened file name matching the class package name.
  -     * @throws java.io.IOException upon failure to read the java file
  +     * @throws IOException upon failure to read the java file
        */
  -    public static final String getPackagePath(String absoluteFileName)
  -        throws IOException
  +    public static final String getPackagePath(String absoluteFileName) throws
  +        IOException
       {
           String shortenedPath;
   
  
  
  
  1.16      +20 -10    jakarta-turbine-maven/src/java/org/apache/maven/MavenUtils.java
  
  Index: MavenUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/MavenUtils.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- MavenUtils.java   15 May 2002 00:37:08 -0000      1.15
  +++ MavenUtils.java   27 May 2002 09:10:33 -0000      1.16
  @@ -73,7 +73,7 @@
    * the project.
    *
    * @author <a href="[EMAIL PROTECTED]">Jason van Zyl</a>
  - * @version $Id: MavenUtils.java,v 1.15 2002/05/15 00:37:08 dion Exp $
  + * @version $Id: MavenUtils.java,v 1.16 2002/05/27 09:10:33 dion Exp $
    */
   public class MavenUtils
   {
  @@ -106,7 +106,8 @@
           throws Exception
       {
           Mapper mapper = new Mapper();
  -        Project project = (Project) mapper.map(projectDescriptor, PROJECT_CLASS);
  +        Project project = (Project) mapper.map(projectDescriptor, 
  +            PROJECT_CLASS);
           return project;
       }
   
  @@ -115,7 +116,7 @@
        * descriptor.
        * 
        * @param workspaceDescriptor the file name of a maven workspace descriptor
  -     * @param projectDescriptor the file name of a maven project descriptor
  +     * @param profileDescriptor the file name of a maven project descriptor
        * @param mavenLocalRepo a local maven repository
        * @return a maven {@link Workspace} specifed by the given descriptors
        * @throws Exception when any error occurs
  @@ -131,9 +132,14 @@
       }
   
       /**
  -     * Create a Project object given a file descriptor.
  +     * Create a <code>{@link Workspace}</code> object given a workspace 
  +     * descriptor, a project descriptor and a local repository.
  +     * @param workspaceDescriptor the xml file describing the workspace
  +     * @param profileDescriptor the xml file describing the projects to build
  +     * @param mavenLocalRepo the local maven repository
  +     * @return a {@link Workspace} object ready for building
        *
  -     * @throws Exception
  +     * @throws Exception when an error occurs
        */
       public static Workspace getWorkspace(File workspaceDescriptor, 
                                            File profileDescriptor,
  @@ -142,11 +148,13 @@
       {
           // Create our workspace
           Mapper workspaceMapper = new Mapper();        
  -        Workspace workspace = (Workspace) workspaceMapper.map(workspaceDescriptor, 
Workspace.class.getName());
  +        Workspace workspace = (Workspace) workspaceMapper.map(
  +            workspaceDescriptor, Workspace.class.getName());
               
           // Create our profile
           Mapper profileMapper = new Mapper();        
  -        Profile profile = (Profile) profileMapper.map(profileDescriptor, 
Profile.class.getName());
  +        Profile profile = (Profile) profileMapper.map(profileDescriptor, 
  +            Profile.class.getName());
           workspace.setProfile(profile);
               
           // Create our set of project.
  @@ -156,12 +164,14 @@
               // This should take care of any trailing slashes, or the directory
               // formatted in any arbitrary fashion. I don't want to expect a
               // particular format because people do everything different.
  -            File baseDir = new File(new File(mavenLocalRepo, "project"), projectId);
  +            File baseDir = new File(new File(mavenLocalRepo, "project"), 
  +                projectId);
               File projectDescriptor = new File(baseDir, "project.xml");
               
               // Map the project descriptors and add them to the profile.
               Mapper projectMapper = new Mapper();
  -            Project project = (Project) projectMapper.map(projectDescriptor, 
Project.class.getName());
  +            Project project = (Project) projectMapper.map(projectDescriptor, 
  +                Project.class.getName());
               profile.addProject(project);
           }
           
  @@ -202,7 +212,7 @@
   
           for (int i = 0; i < files.length; i++)
           {
  -            files[i] = new File(directory,files[i]).getAbsolutePath();
  +            files[i] = new File(directory, files[i]).getAbsolutePath();
           }
   
           return files;
  
  
  
  1.7       +43 -24    
jakarta-turbine-maven/src/java/org/apache/maven/ProjectVerifier.java
  
  Index: ProjectVerifier.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ProjectVerifier.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ProjectVerifier.java      23 May 2002 01:18:45 -0000      1.6
  +++ ProjectVerifier.java      27 May 2002 09:10:33 -0000      1.7
  @@ -65,7 +65,6 @@
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.List;
  -import java.util.ArrayList;
   import java.util.Map;
   import java.util.StringTokenizer;
   
  @@ -82,7 +81,7 @@
    *
    * @author <a href="[EMAIL PROTECTED]">Jason van Zyl</a>
    * @author <a href="[EMAIL PROTECTED]">Vincent Massol</a>
  - * @version $Id: ProjectVerifier.java,v 1.6 2002/05/23 01:18:45 dion Exp $
  + * @version $Id: ProjectVerifier.java,v 1.7 2002/05/27 09:10:33 dion Exp $
    * @task Create a list of all things that could go wrong and then protect
    *       against them.
    * @task Merge the XML POM validation mechanism in here.
  @@ -145,6 +144,7 @@
   
       /**
        * Sets the proxyHost attribute.
  +     * @param proxyHost the value to set
        */
       public void setProxyHost(String proxyHost)
       {
  @@ -154,6 +154,7 @@
   
       /**
        * Sets the proxyPort attribute.
  +     * @param proxyPort the value to set
        */
       public void setProxyPort(String proxyPort)
       {
  @@ -163,6 +164,7 @@
   
       /**
        * Sets the mavenLocalRepo attribute.
  +     * @param mavenLocalRepo the local repository
        */
       public void setMavenLocalRepo(String mavenLocalRepo)
       {
  @@ -171,6 +173,7 @@
       
       /**
        * Get the maven local repo.
  +     * @return the local repo
        */
       public String getMavenLocalRepo()
       {
  @@ -180,18 +183,20 @@
       /**
        * Sets the mavenRemoteRepo attribute.  This can be a comma separated list
        * of URLs.
  +     * @param mavenRemoteRepo the new value to set
        */
       public void setMavenRemoteRepo(String mavenRemoteRepo)
       {
  -        StringTokenizer st = new StringTokenizer( mavenRemoteRepo, "," );
  +        StringTokenizer st = new StringTokenizer(mavenRemoteRepo, ",");
           while (st.hasMoreTokens())
           {
  -            mavenRemoteRepos.add( st.nextToken().trim() );
  +            mavenRemoteRepos.add(st.nextToken().trim());
           }
       }
   
       /**
        * Get the maven remote repository list of URLs.
  +     * @return the remote repositories as a {@link List} of strings
        */
       public List getMavenRemoteRepo()
       {
  @@ -210,6 +215,7 @@
       /**
        * Check to see that all dependencies are present and if they are
        * not then download them.
  +     * @throws Exception when an error occurs verifying
        */
       private void verifyDependencies()
           throws Exception
  @@ -217,7 +223,7 @@
           for (Iterator i = getMavenProject().getDependencies().iterator();
                i.hasNext();)
           {
  -            Dependency dependency = (Dependency)i.next();
  +            Dependency dependency = (Dependency) i.next();
               String jar = dependency.getJar();
           
               File jarFile = new File(getMavenLocalRepo(), jar);
  @@ -238,9 +244,9 @@
               File f = new File(getMavenLocalRepo(), NON_DIST_JAR_LIST);
   
               Map nonDistMap;
  -            if (!getNonDistFile( f ))
  +            if (!getNonDistFile(f))
               {
  -                StringBuffer msg = new StringBuffer( 128 );
  +                StringBuffer msg = new StringBuffer(128);
                   msg.append("-----------------------------------------------\n")
                      .append("W A R N I N G\n")
                      .append("-----------------------------------------------\n")
  @@ -249,9 +255,9 @@
                      .append(NON_DIST_JAR_LIST)
                      .append("\n")
                      .append("Will continue with attempted downloads of ")
  -                   .append("dependent jars.\n\n" );
  +                   .append("dependent jars.\n\n");
   
  -                log( msg.toString() );
  +                log(msg.toString());
   
                   nonDistMap = new HashMap(0);
               }
  @@ -263,14 +269,15 @@
               for (Iterator i = failedDependencies.iterator(); i.hasNext();)
               {
                   String dependency = (String) i.next();
  -                File destinationFile = new File(getMavenLocalRepo(),dependency);
  +                File destinationFile = new File(getMavenLocalRepo(), 
  +                    dependency);
                   
                   if (nonDistMap.containsKey(dependency))
                   {
                       if (!destinationFile.exists())
                       {
                           String[] entry = Strings.split(
  -                            (String)nonDistMap.get(dependency),"$");
  +                            (String) nonDistMap.get(dependency), "$");
                           String downloadLocation = entry[0];
                           String additionalNotes = entry[1];
                       
  @@ -292,7 +299,7 @@
                       continue;
                   }
   
  -                if (!getRemoteFile( dependency, destinationFile ))
  +                if (!getRemoteFile(dependency, destinationFile))
                   {
                       warnings.append("-------------------------------------" +
                           "------------\n");
  @@ -313,38 +320,46 @@
               // We have warnings so that means there are non-dist jars
               // that the user has to retrieve so the build can't
               // continue.
  -            getProject().setProperty("verificationFailed","true");
  +            getProject().setProperty("verificationFailed", "true");
           }            
       }
   
       /**
        * Download the list of non-distributable jars.
  +     * @param f the file to store the list of non-distributable jars in
  +     * @return true if the download succeeded, false otherwise
        */
       private boolean getNonDistFile(File f)
       {
  -        return getRemoteFile( f.getName(), f );
  +        return getRemoteFile(f.getName(), f);
       }
   
  -    private boolean getRemoteFile( String remoteFile, File localFile )
  +    /** Retrieve a <code>remoteFile</code> from the maven remote repositories
  +     * and store it at <code>localFile</code>
  +     * @param remoteFile the file name to retrieve from the repositories
  +     * @param localFile the file name to store the remote file locally
  +     * @return true if the retrieval succeeds, false otherwise
  +     */
  +    private boolean getRemoteFile(String remoteFile, File localFile)
       {
           boolean gotFile = false;
           Iterator remoteIter = getMavenRemoteRepo().iterator();
   
           while (!gotFile && remoteIter.hasNext())
           {
  -            String remoteRepo = (String)remoteIter.next();
  +            String remoteRepo = (String) remoteIter.next();
               try
               {
  -                gotFile = HttpUtils.getFile( new URL(remoteRepo + remoteFile),
  +                gotFile = HttpUtils.getFile(new URL(remoteRepo + remoteFile),
                                               localFile, remoteFile, verbose,
                                               ignoreErrors, useTimestamp, 
  -                                            "", "" );
  +                                            "", "");
               }
               catch (MalformedURLException mue)
               {
                   mue.printStackTrace();
                   log("Cannot retrieve " + remoteFile + " from " + remoteRepo +
  -                        "; malformed URL" );
  +                        "; malformed URL");
               }
           }
   
  @@ -353,6 +368,9 @@
       
       /**
        * Get a list of JARs that cannon be distributed by Maven.
  +     * @param f the file that holds the list of non-distributable jars
  +     * @return a map where the non-distributable jar name is the key and 
  +     *     the value is the location where the user can find it
        */
       private Map getNonDistMap(File f)
       {
  @@ -362,7 +380,7 @@
           try
           {
               BufferedReader in = new BufferedReader(new FileReader(f));
  -            while ((line=in.readLine()) != null)
  +            while ((line = in.readLine()) != null)
               {
                   line = line.trim();
                   
  @@ -374,14 +392,15 @@
                       continue;
                   }
                   
  -                String[] entry = Strings.split(line,"|");
  +                String[] entry = Strings.split(line, "|");
                   
  -                // The name of the non-dist JAR is the key, and the value is the
  -                // location where the user can find it.
                   nonDistMap.put(entry[0], entry[1]);
               }
           }
  -        catch (Exception e) {e.printStackTrace();}
  +        catch (Exception e)
  +        {
  +            e.printStackTrace();
  +        }
           
           return nonDistMap;
       }
  
  
  
  1.10      +16 -15    
jakarta-turbine-maven/src/java/org/apache/maven/ProjectResolver.java
  
  Index: ProjectResolver.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ProjectResolver.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ProjectResolver.java      25 Mar 2002 01:56:08 -0000      1.9
  +++ ProjectResolver.java      27 May 2002 09:10:33 -0000      1.10
  @@ -63,7 +63,6 @@
   import java.util.LinkedList;
   import java.util.jar.JarFile;
   import java.util.jar.JarEntry;
  -import java.util.Map;
   import java.util.StringTokenizer;
   import java.util.Properties;
   import java.util.HashMap;
  @@ -80,7 +79,7 @@
    * in a project descriptor.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
  - * @version $Id: ProjectResolver.java,v 1.9 2002/03/25 01:56:08 jvanzyl Exp $
  + * @version $Id: ProjectResolver.java,v 1.10 2002/05/27 09:10:33 dion Exp $
    */
   public class ProjectResolver
   {
  @@ -91,8 +90,8 @@
       private File base;
       
       /**
  -     * Listener that registers class references as they
  -     * are found by the {@link org.apache.maven.importscrubber.ClassParserWrapper}
  +     * Listener that registers class references as they are found by the 
  +     * {@link ClassParserWrapper}
        */
       private TreeMapListener treeMapListener;
       
  @@ -132,13 +131,12 @@
        * Set the packages to exclude from the final list found
        * by the resolution process.
        *
  -     * @param String packageExcludesList Comma separate list of
  -     *               the packages to exclude from the final list of
  -     *               packages.
  +     * @param packageExcludesList comma separate list of the packages to exclude
  +     *   from the final list of packages.
        */
       public void setPackageExcludes(String packageExcludesList)
       {
  -        StringTokenizer st = new StringTokenizer(packageExcludesList,",");
  +        StringTokenizer st = new StringTokenizer(packageExcludesList, ",");
           while (st.hasMoreTokens())
           {
               String packageExclude = st.nextToken();
  @@ -150,8 +148,7 @@
        * Set the directory in which JARs and class files are
        * searched for.
        *
  -     * @param baseDirectory Directory in which JARs and class files
  -     *                      are searched for.
  +     * @param base Directory in which JARs and class files are searched for.
        */
       public void setBase(File base)
       {
  @@ -161,7 +158,7 @@
       /**
        * Set the location of the package -> project map.
        *
  -     * @param map Location of the package -> project map.
  +     * @param mapFile Location of the package -> project map.
        */
       public void setMapFile(File mapFile)
       {
  @@ -248,7 +245,7 @@
                   if (classReference.indexOf(packageKey) == 0)
                   {
                       Object o = map.get(packageKey);
  -                    projects.put(o,o);
  +                    projects.put(o, o);
                   }
               }
           }            
  @@ -259,6 +256,7 @@
       /**
        * Process an individual JAR file looking package
        * dependencies.
  +     * @param file the jar file to process
        */
       public void processJAR(String file)
       {
  @@ -279,7 +277,8 @@
   
               jarFile.close();
               
  -            for (Iterator i = treeMapListener.getTreeMap().keySet().iterator(); 
i.hasNext();)
  +            for (Iterator i = treeMapListener.getTreeMap().keySet().iterator();
  +                i.hasNext();)
               {
                   String classReference = (String) i.next();
                   processClassReference(classReference);
  @@ -294,12 +293,13 @@
       /**
        * Process an individual class file.
        *
  -     * @param classReference An individual class reference in the form of a string.
  +     * @param classReference An individual class reference as a string.
        */
       private void processClassReference(String classReference)
       {
           // Don't care about inner classes.
  -        if (classReference.indexOf("$") < 0 && classReference.startsWith("[") == 
false)
  +        if (classReference.indexOf("$") < 0 && 
  +            classReference.startsWith("[") == false)
           {
               boolean includePackage = true;
                       
  @@ -323,6 +323,7 @@
       
       /**
        * Used for testing only.
  +     * @param args command line parameters
        */
       public static void main(String[] args)
       {
  
  
  
  1.35      +17 -11    
jakarta-turbine-maven/src/java/org/apache/maven/ProjectProperties.java
  
  Index: ProjectProperties.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ProjectProperties.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- ProjectProperties.java    27 May 2002 05:20:32 -0000      1.34
  +++ ProjectProperties.java    27 May 2002 09:10:33 -0000      1.35
  @@ -80,7 +80,7 @@
    *
    * @author <a href="[EMAIL PROTECTED]">Jason van Zyl</a>
    * @author <a href="[EMAIL PROTECTED]">Vincent Massol</a>
  - * @version $Id: ProjectProperties.java,v 1.34 2002/05/27 05:20:32 dion Exp $
  + * @version $Id: ProjectProperties.java,v 1.35 2002/05/27 09:10:33 dion Exp $
    */
   public class ProjectProperties
       extends ProjectExecutor
  @@ -127,7 +127,7 @@
           
           // Let the build process know that the POM has
           // been loaded.
  -        getProject().setProperty("maven.pomLoaded","true");
  +        getProject().setProperty("maven.pomLoaded", "true");
   
           // If there are no build parameters in the POM then we can
           // can just leave now.
  @@ -166,8 +166,8 @@
           
           if (mavenPrepareSourceDirectory != null)
           {
  -            AntUtils.createPatternSetReferenceFromPaths(
  -                getProject(),"maven.src.set.patternset",
  +            AntUtils.createPatternSetReferenceFromPaths(getProject(), 
  +                "maven.src.set.patternset",
                   getMavenProject().getBuild().getSourceDirectories());
   
               Path srcSet = new Path(getProject());
  @@ -187,7 +187,7 @@
           {
               File utdir = new File(getProject().getProperty("basedir"),
                   getMavenProject().getBuild().getUnitTestSourceDirectory());
  -            if ( utdir.exists() )
  +            if (utdir.exists())
               {
                   getProject().setProperty("maven.unitTestSourceDirectory",
                       utdir.getCanonicalPath());
  @@ -220,9 +220,10 @@
   
                   log("Creating integration unit test class entries reference ..."
                       , Project.MSG_DEBUG);
  -                AntUtils.createPatternSetReference(
  -                    getProject(),"maven.integration.unit.test.set",
  -                    getMavenProject().getBuild().getIntegrationUnitTestPatterns());
  +                AntUtils.createPatternSetReference(getProject(),
  +                    "maven.integration.unit.test.set",
  +                    getMavenProject().getBuild().
  +                        getIntegrationUnitTestPatterns());
               }
           }
   
  @@ -233,6 +234,9 @@
        * Set a project property. We check to see that the value
        * exists in the POM by turning the mavenProject bean into
        * a Map using the BeanMap utility in the commons-collections.
  +     * @param key the project property name to set. This will be prefixed with
  +     *   'maven.' This is also the key used to fetch the value.
  +     * @param values the map to fetch the property value from.
        */
       private void setProjectProperty(String key, Map values)
       {
  @@ -243,7 +247,7 @@
               if (value.length() > 0 && getProject().getProperty(key) == null)
               {
                   getProject().setProperty("maven." + key,
  -                    (String)values.get(key));
  +                    (String) values.get(key));
               }                
           }
       }
  @@ -277,10 +281,10 @@
           for (Iterator i = getMavenProject().getDependencies().iterator();
                i.hasNext();)
           {
  -            Dependency dep = (Dependency)i.next();
  +            Dependency dep = (Dependency) i.next();
               depNames.add(dep.getJar());
           } // end of for (Iterator  = .iterator(); .hasNext();)
  -        AntUtils.createPatternSetReference(getProject(),"maven.dependency.set",
  +        AntUtils.createPatternSetReference(getProject(), "maven.dependency.set",
               depNames);
       }
       
  @@ -326,6 +330,7 @@
               getMavenProject().getBuild().getJarResources());
       }
   
  +    /** Create maven.organization. properties */
       private void createOrganizationProperties()
       {
           if (getMavenProject().getOrganization() != null)
  @@ -338,6 +343,7 @@
           }
       }
   
  +    /** Create properties relating to the distribution build */
       private void createDistProperties()
       {
           String id = getProject().getProperty("distid");
  
  
  
  1.5       +18 -17    
jakarta-turbine-maven/src/java/org/apache/maven/PackageProjectMap.java
  
  Index: PackageProjectMap.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/PackageProjectMap.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PackageProjectMap.java    16 May 2002 15:14:41 -0000      1.4
  +++ PackageProjectMap.java    27 May 2002 09:10:33 -0000      1.5
  @@ -56,10 +56,8 @@
   
   import java.io.File;
   import java.io.FileOutputStream;
  -
   import java.util.Properties;
   
  -import org.apache.maven.MavenUtils;
   import org.apache.maven.executor.AbstractExecutor;
   import org.apache.maven.project.Project;
   
  @@ -70,7 +68,7 @@
    * references.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
  - * @version $Id: PackageProjectMap.java,v 1.4 2002/05/16 15:14:41 tcopeland Exp $
  + * @version $Id: PackageProjectMap.java,v 1.5 2002/05/27 09:10:33 dion Exp $
    */
   public class PackageProjectMap
        extends AbstractExecutor
  @@ -107,10 +105,9 @@
       }
   
       /**
  -     * Set the directory where all the Maven descriptors are stored.
  +     * Where to write the resultant package -> project map
        *
  -     * @param descriptorDir The directory where all the Maven descriptors are
  -     *      stored.
  +     * @param map The file where the package -> project map is stored
        */
       public void setMap(File map)
       {
  @@ -118,9 +115,9 @@
       }
   
       /**
  -     * Get the directory where all the Maven descriptors are stored.
  +     * Get where to write the resultant package -> project map
        *
  -     * @return The directory where all the Maven descriptors are stored.
  +     * @return The file to write the resultant package -> project map to
        */
       public File getMap()
       {
  @@ -130,7 +127,7 @@
       /**
        * Execute the the overall maven opertion.
        *
  -     * @throws BuildException
  +     * @throws Exception when an error occurs
        */
       public void execute()
           throws Exception
  @@ -166,13 +163,17 @@
           }
           
           FileOutputStream fos = null;
  -                             try {
  -             fos = new FileOutputStream(map);
  -             m.store(fos,"Package -> Project Map");
  -                             } finally {
  -                                     if (fos != null) {
  -                                             fos.close();
  -                                     }
  -                             }
  +        try
  +        {
  +            fos = new FileOutputStream(map);
  +            m.store(fos, "Package -> Project Map");
  +        }
  +        finally
  +        {
  +            if (fos != null)
  +            {
  +                fos.close();
  +            }
  +        }
       }
   }
  
  
  
  1.3       +17 -29    
jakarta-turbine-maven/src/java/org/apache/maven/ProjectResolverSource.java
  
  Index: ProjectResolverSource.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ProjectResolverSource.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProjectResolverSource.java        16 Apr 2002 18:36:37 -0000      1.2
  +++ ProjectResolverSource.java        27 May 2002 09:10:33 -0000      1.3
  @@ -55,14 +55,9 @@
    */
   import java.io.File;
   import java.io.FileInputStream;
  -import java.io.InputStream;
  -
   import java.util.Iterator;
   import java.util.List;
   import java.util.LinkedList;
  -import java.util.jar.JarFile;
  -import java.util.jar.JarEntry;
  -import java.util.Map;
   import java.util.StringTokenizer;
   import java.util.Properties;
   import java.util.HashMap;
  @@ -77,7 +72,7 @@
    * of dependencies in a project descriptor.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
  - * @version $Id: ProjectResolverSource.java,v 1.2 2002/04/16 18:36:37 jvanzyl Exp $
  + * @version $Id: ProjectResolverSource.java,v 1.3 2002/05/27 09:10:33 dion Exp $
    */
   public class ProjectResolverSource
   {
  @@ -86,29 +81,20 @@
        * just a JAR file.
        */
       private File base;
  -
       /**
        * Package references that are collected by mapping the class references to
        * package references.
        */
       private List packageReferences;
  -
  -    /**
  -     * Packages to exclude from the final list of packages.
  -     */
  +    /** Packages to exclude from the final list of packages */
       private List packageExcludes;
  -
  -    /**
  -     * Package -> Project map.
  -     */
  +    /** Package -> Project map */
       private File mapFile;
  -
  -    /**
  -     * Project references.
  -     */
  +    /** Project references */
       private List projectReferences;
  -
  +    /** used to process source code with a visitor */
       private SourceTool st;
  +    /** visitor to process import statements */
       private ImportStatementVisitor isv;
   
       /**
  @@ -129,7 +115,7 @@
        * Set the packages to exclude from the final list found by the resolution
        * process.
        *
  -     * @param String packageExcludesList Comma separate list of the packages to
  +     * @param packageExcludesList comma separate list of the packages to
        *      exclude from the final list of packages.
        */
       public void setPackageExcludes(String packageExcludesList)
  @@ -145,8 +131,7 @@
       /**
        * Set the directory in which JARs and class files are searched for.
        *
  -     * @param baseDirectory Directory in which JARs and class files are searched
  -     *      for.
  +     * @param base directory in which JARs and class files are searched for.
        */
       public void setBase(File base)
       {
  @@ -156,7 +141,7 @@
       /**
        * Set the location of the package -> project map.
        *
  -     * @param map Location of the package -> project map.
  +     * @param mapFile Location of the package -> project map.
        */
       public void setMapFile(File mapFile)
       {
  @@ -186,6 +171,7 @@
       /**
        * Resolve the package dependencies from the set of JARs and classes used as
        * the input.
  +     * @throws Exception when any error occurs
        */
       public void resolveDependencies()
           throws Exception
  @@ -205,7 +191,7 @@
               }
           }
   
  -        for (Iterator j = isv.getImportStatements().iterator(); j.hasNext(); )
  +        for (Iterator j = isv.getImportStatements().iterator(); j.hasNext();)
           {   
               String classReference = (String) j.next();
               processClassReference(classReference);
  @@ -226,11 +212,11 @@
           HashMap projects = new HashMap();
   
           List packageReferences = getPackageReferences();
  -        for (Iterator i = packageReferences.iterator(); i.hasNext(); )
  +        for (Iterator i = packageReferences.iterator(); i.hasNext();)
           {
               String classReference = (String) i.next();
   
  -            for (Iterator j = map.keySet().iterator(); j.hasNext(); )
  +            for (Iterator j = map.keySet().iterator(); j.hasNext();)
               {
                   String packageKey = (String) j.next();
   
  @@ -255,7 +241,7 @@
       {
           boolean includePackage = true;
   
  -        for (Iterator j = packageExcludes.iterator(); j.hasNext(); )
  +        for (Iterator j = packageExcludes.iterator(); j.hasNext();)
           {
               String packageExclude = (String) j.next();
               if (classReference.startsWith(packageExclude))
  @@ -273,6 +259,8 @@
   
       /**
        * Used for testing only.
  +     * @param args command line args
  +     * @throws Exception when any error occurs
        */
       public static void main(String[] args)
           throws Exception
  @@ -284,7 +272,7 @@
           bdr.resolveDependencies();
   
           List projectReferences = bdr.getProjectReferences();
  -        for (Iterator i = projectReferences.iterator(); i.hasNext(); )
  +        for (Iterator i = projectReferences.iterator(); i.hasNext();)
           {
               System.out.println(i.next());
           }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to