donaldp     01/12/17 02:10:49

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs
                        Available.java Expand.java Replace.java Zip.java
               proposal/myrmidon/src/main/org/apache/tools/ant/util
                        FileUtils.java
  Log:
  File.getParentFile is availablae in JDK1.2+ !
  
  Revision  Changes    Path
  1.6       +2 -2      
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java
  
  Index: Available.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Available.java    2001/12/16 06:21:40     1.5
  +++ Available.java    2001/12/17 10:10:49     1.6
  @@ -275,7 +275,7 @@
                   }
   
                   FileUtils fileUtils = FileUtils.newFileUtils();
  -                File parent = fileUtils.getParentFile( path );
  +                File parent = path.getParentFile();
                   // **   full-pathname specified == parent dir of path in list
                   if( parent != null && parent.exists()
                       && file.equals( parent.getAbsolutePath() ) )
  @@ -317,7 +317,7 @@
                   // **   simple name specified   == parent of parent dir + 
name
                   if( parent != null )
                   {
  -                    File grandParent = fileUtils.getParentFile( parent );
  +                    File grandParent = parent.getParentFile();
                       if( grandParent != null && grandParent.exists() )
                       {
                           if( checkFile( new File( grandParent, file ),
  
  
  
  1.6       +1 -1      
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Expand.java
  
  Index: Expand.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Expand.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Expand.java       2001/12/17 09:57:28     1.5
  +++ Expand.java       2001/12/17 10:10:49     1.6
  @@ -251,7 +251,7 @@
               log( "expanding " + entryName + " to " + f,
                    Project.MSG_VERBOSE );
               // create intermediary directories - sometimes zip don't add them
  -            File dirF = fileUtils.getParentFile( f );
  +            File dirF = f.getParentFile();
               dirF.mkdirs();
   
               if( isDirectory )
  
  
  
  1.4       +1 -1      
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java
  
  Index: Replace.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Replace.java      2001/12/16 00:38:01     1.3
  +++ Replace.java      2001/12/17 10:10:49     1.4
  @@ -296,7 +296,7 @@
           }
   
           File temp = fileUtils.createTempFile( "rep", ".tmp",
  -                                              fileUtils.getParentFile( src ) 
);
  +                                              src.getParentFile() );
   
           Reader reader = null;
           Writer writer = null;
  
  
  
  1.6       +1 -1      
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java
  
  Index: Zip.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Zip.java  2001/12/16 05:44:55     1.5
  +++ Zip.java  2001/12/17 10:10:49     1.6
  @@ -237,7 +237,7 @@
           {
               FileUtils fileUtils = FileUtils.newFileUtils();
               renamedFile = fileUtils.createTempFile( "zip", ".tmp",
  -                                                    fileUtils.getParentFile( 
zipFile ) );
  +                                                    zipFile.getParentFile() 
);
   
               try
               {
  
  
  
  1.5       +3 -24     
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/util/FileUtils.java
  
  Index: FileUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/util/FileUtils.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileUtils.java    2001/12/17 09:57:28     1.4
  +++ FileUtils.java    2001/12/17 10:10:49     1.5
  @@ -32,13 +32,12 @@
    * @author [EMAIL PROTECTED]
    * @author <a href="mailto:[EMAIL PROTECTED]">Conor MacNeill</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   
   public class FileUtils
   {
       private static Random rand = new Random( System.currentTimeMillis() );
  -    private static Object lockReflection = new Object();
   
       /**
        * Empty constructor.
  @@ -58,26 +57,6 @@
       }
   
       /**
  -     * Emulation of File.getParentFile for JDK 1.1
  -     *
  -     * @param f Description of Parameter
  -     * @return The ParentFile value
  -     * @since 1.10
  -     */
  -    public File getParentFile( File f )
  -    {
  -        if( f != null )
  -        {
  -            String p = f.getParent();
  -            if( p != null )
  -            {
  -                return new File( p );
  -            }
  -        }
  -        return null;
  -    }
  -
  -    /**
        * Compares the contents of two files.
        *
        * @param f1 Description of Parameter
  @@ -300,7 +279,7 @@
   
               // ensure that parent dir of dest file exists!
               // not using getParentFile method to stay 1.1 compat
  -            File parent = getParentFile( destFile );
  +            File parent = destFile.getParentFile();
               if( !parent.exists() )
               {
                   parent.mkdirs();
  @@ -577,7 +556,7 @@
               String part = tok.nextToken();
               if( part.equals( ".." ) )
               {
  -                helpFile = getParentFile( helpFile );
  +                helpFile = helpFile.getParentFile();
                   if( helpFile == null )
                   {
                       String msg = "The file or path you specified ("
  
  
  

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

Reply via email to