ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound SoundTask.java
Date Sun, 06 Jan 2002 02:17:57 GMT
donaldp     02/01/05 18:17:57

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound
                        SoundTask.java
  Log:
  Cleanup
  
  Revision  Changes    Path
  1.10      +15 -10    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java
  
  Index: SoundTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SoundTask.java	30 Dec 2001 08:19:21 -0000	1.9
  +++ SoundTask.java	6 Jan 2002 02:17:57 -0000	1.10
  @@ -24,7 +24,7 @@
    * in xml and have Ant play them back
    *
    * @author Nick Pellow
  - * @version $Revision: 1.9 $, $Date: 2001/12/30 08:19:21 $
  + * @version $Revision: 1.10 $, $Date: 2002/01/06 02:17:57 $
    */
   public class SoundTask
       extends Task
  @@ -45,11 +45,13 @@
       }
   
       public void execute()
  +        throws TaskException
       {
           final AntSoundPlayer soundPlayer = new AntSoundPlayer();
           if( null == m_success )
           {
  -            getLogger().warn( "No nested success element found." );
  +            final String message = "No nested success element found.";
  +            getLogger().warn( message );
           }
           else
           {
  @@ -59,7 +61,8 @@
   
           if( null == m_fail )
           {
  -            getLogger().warn( "No nested failure element found." );
  +            final String message = "No nested failure element found.";
  +            getLogger().warn( message );
           }
           else
           {
  @@ -72,10 +75,9 @@
   
       /**
        * Gets the location of the file to get the audio.
  -     *
  -     * @return The Source value
        */
       private File getRandomSource( final BuildAlert alert )
  +        throws TaskException
       {
           final File source = alert.getSource();
           // Check if source is a directory
  @@ -96,22 +98,25 @@
                   }
                   if( files.size() < 1 )
                   {
  -                    throw new TaskException( "No files found in directory " + source );
  +                    final String message = "No files found in directory " + source;
  +                    throw new TaskException( message );
                   }
                   final int numfiles = files.size();
                   // get a random number between 0 and the number of files
                   final Random random = new Random();
                   final int x = random.nextInt( numfiles );
                   // set the source to the file at that location
  -                source = (File)files.get( x );
  +                return (File)files.get( x );
  +            }
  +            else
  +            {
  +                return null;
               }
           }
           else
           {
               getLogger().warn( source + ": invalid path." );
  -            source = null;
  +            return null;
           }
  -        return source;
       }
   }
  -
  
  
  

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


Mime
View raw message