jvanzyl     2002/11/12 17:49:37

  Modified:    src/java/org/apache/maven/app App.java Maven.java
  Log:
  o remove while->iterator idiom in favour of for->iterator idiom.
  
  Revision  Changes    Path
  1.31      +15 -24    jakarta-turbine-maven/src/java/org/apache/maven/app/App.java
  
  Index: App.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/App.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- App.java  12 Nov 2002 04:04:36 -0000      1.30
  +++ App.java  13 Nov 2002 01:49:36 -0000      1.31
  @@ -651,30 +651,23 @@
           Collections.sort(list, comparator);
   
   
  -        Iterator goalIter = list.iterator();
           int wrapIndent = 30;
  -        String lastPluginName = "";
           String msgPrefix = "";
  -        String goalDescription = null;
  -        String goalName = null;
  -        String pluginName;
           boolean hasDesc = false;
  -        boolean newPlugin = false;
           boolean firstLine = true;
           boolean haveGoalsWithNoDescription = false;
  +        String lastPluginName = "";
   
  -        while (goalIter.hasNext())
  +        for (Iterator i = list.iterator(); i.hasNext();)
           {
  -            goalName = (String) goalIter.next(); // goal name
  -            goalDescription = getMaven().getPluginManager().getGoalDescription( 
goalName );
  +            String goalName = (String) i.next(); // goal name
  +            String goalDescription = 
getMaven().getPluginManager().getGoalDescription( goalName );
   
               StringTokenizer st = new StringTokenizer(goalName, ":");
  -            pluginName = st.nextToken(); //ex. java
  -            newPlugin = !pluginName.equals(lastPluginName);
  +            String pluginName = st.nextToken(); //ex. java
  +            boolean newPlugin = !pluginName.equals(lastPluginName);
   
  -            /*
  -             * prepare the description
  -             */
  +            // Prepare the description
               if (goalDescription == null)
               {
                   hasDesc = false;
  @@ -704,11 +697,9 @@
                     // +1 pad for space on the end
                     wrapIndent++;
   
  -                  /*
  -                   * if the goal found for a new plugin is not the default
  -                   * goal, then we make the plugin description something that
  -                   * makes clear there is no default goal defined
  -                   */
  +                  // if the goal found for a new plugin is not the default
  +                  // goal, then we make the plugin description something that
  +                  // makes clear there is no default goal defined
                     msgPrefix = pluginName
                                 + "] ( NO DEFAULT GOAL )\n"
                                 + msgPrefix;
  @@ -791,12 +782,12 @@
               System.out.println();
               System.out.println("Non documented goals : ");
               System.out.println();
  -            goalIter = list.iterator();
  -            while (goalIter.hasNext())
  +            
  +            for (Iterator i = list.iterator(); i.hasNext();)
               {
  -                goalName = (String) goalIter.next();
  +                String goalName = (String) i.next();
   
  -                goalDescription = getMaven().getPluginManager().getGoalDescription( 
goalName );
  +                String goalDescription = 
getMaven().getPluginManager().getGoalDescription( goalName );
   
                   /*
                    * prepare the description
  
  
  
  1.132     +7 -15     jakarta-turbine-maven/src/java/org/apache/maven/app/Maven.java
  
  Index: Maven.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/Maven.java,v
  retrieving revision 1.131
  retrieving revision 1.132
  diff -u -r1.131 -r1.132
  --- Maven.java        13 Nov 2002 00:19:00 -0000      1.131
  +++ Maven.java        13 Nov 2002 01:49:36 -0000      1.132
  @@ -173,9 +173,6 @@
       /** Project directory. */
       private File dir;
   
  -    /** ${basedir}/project.xml file. */
  -    private File projectFile;
  -
       /** ${basedir}/build.maven file (or null). */
       private File projectBuildFile;
   
  @@ -832,17 +829,13 @@
               }
           }
   
  -        Iterator goalNameIter = goalNames.iterator();
  -        String   eachGoalName = null;
  -        Goal     eachGoal     = null;
  -
  -        while (goalNameIter.hasNext())
  +        for (Iterator i = goalNames.iterator(); i.hasNext();)
           {
  -            eachGoalName = (String) goalNameIter.next();
  +            String eachGoalName = (String) i.next();
   
               getPluginManager().prepForGoal( eachGoalName );
   
  -            eachGoal = getWerkzProject().getGoal(eachGoalName);
  +            Goal eachGoal = getWerkzProject().getGoal(eachGoalName);
   
               if (eachGoal == null)
               {
  @@ -850,15 +843,14 @@
               }
           }
   
  -        goalNameIter = goalNames.iterator();
           Session session = new JellySession(output);
           Thread.currentThread().setContextClassLoader(null);
   
  -        while (goalNameIter.hasNext())
  +        for (Iterator i = goalNames.iterator(); i.hasNext();)
           {
  -            eachGoalName = (String) goalNameIter.next();
  +            String eachGoalName = (String) i.next();
   
  -            eachGoal = werkzProject.getGoal(eachGoalName);
  +            Goal eachGoal = werkzProject.getGoal(eachGoalName);
   
               if (eachGoal == null)
               {
  
  
  

--
To unsubscribe, e-mail:   <mailto:turbine-maven-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:turbine-maven-dev-help@;jakarta.apache.org>

Reply via email to