cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2005-05-30 Thread scohen
scohen  2005/05/30 10:56:33

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  Add logging of local vs remote timestamps in ftp task.
  PR:31812
  
  Revision  ChangesPath
  1.79  +28 -8 
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.78
  retrieving revision 1.79
  diff -u -r1.78 -r1.79
  --- FTP.java  30 May 2005 14:41:34 -  1.78
  +++ FTP.java  30 May 2005 17:56:33 -  1.79
  @@ -26,7 +26,9 @@
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.OutputStream;
  +import java.text.SimpleDateFormat;
   import java.util.Collection;
  +import java.util.Date;
   import java.util.Enumeration;
   import java.util.HashMap;
   import java.util.HashSet;
  @@ -1817,6 +1819,10 @@
   }
   return null;
   }
  +
  +private static final SimpleDateFormat TIMESTAMP_LOGGING_SDF = 
  +new SimpleDateFormat(-MM-dd HH:mm:ss);
  +
   /**
* Checks to see if the remote file is current as compared with the local
* file. Returns true if the target file is up to date.
  @@ -1853,16 +1859,30 @@
   
   long remoteTimestamp = files[0].getTimestamp().getTime().getTime();
   long localTimestamp = localFile.lastModified();
  +long adjustedRemoteTimestamp = 
  +remoteTimestamp + this.timeDiffMillis + this.granularityMillis; 
  +
  +StringBuffer msg = new StringBuffer(   [)
  + .append(TIMESTAMP_LOGGING_SDF.format(new Date(localTimestamp)))
  + .append(] local);
  +log(msg.toString(), Project.MSG_VERBOSE);
  +
  +msg = new StringBuffer(   [)
  + .append(TIMESTAMP_LOGGING_SDF.format(new 
Date(adjustedRemoteTimestamp)))
  + .append(] remote);
  +if (remoteTimestamp != adjustedRemoteTimestamp) {
  +msg.append( - (raw: )
  + .append(TIMESTAMP_LOGGING_SDF.format(new Date(remoteTimestamp)))
  +.append());
  +}
  +log(msg.toString(), Project.MSG_VERBOSE);
  +
  +
  +
   if (this.action == SEND_FILES) {
  -return remoteTimestamp 
  - + this.timeDiffMillis 
  - + this.granularityMillis 
  - = localTimestamp;
  +return adjustedRemoteTimestamp = localTimestamp;
   } else {
  -return localTimestamp 
  - = remoteTimestamp 
  - + this.timeDiffMillis
  - + this.granularityMillis;
  +return localTimestamp = adjustedRemoteTimestamp;
   }
   }
   
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2005-05-19 Thread scohen
scohen  2005/05/19 00:58:54

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  fix bug 34941
  
  Revision  ChangesPath
  1.72  +2 -2  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- FTP.java  14 May 2005 13:14:14 -  1.71
  +++ FTP.java  19 May 2005 07:58:54 -  1.72
  @@ -1722,9 +1722,9 @@
   long localTimestamp = localFile.lastModified();
   
   if (this.action == SEND_FILES) {
  -return remoteTimestamp + timeDiffMillis  localTimestamp;
  +return remoteTimestamp + timeDiffMillis = localTimestamp;
   } else {
  -return localTimestamp  remoteTimestamp + timeDiffMillis;
  +return localTimestamp = remoteTimestamp + timeDiffMillis;
   }
   }
   
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2005-05-19 Thread scohen
scohen  2005/05/19 01:54:51

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net Tag:
ANT_16_BRANCH FTP.java
  Log:
  fix defect 34941 on the 1.6 branch
  PR: 34941
  CVS: --
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.52.2.12 +2 -2  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.52.2.11
  retrieving revision 1.52.2.12
  diff -u -r1.52.2.11 -r1.52.2.12
  --- FTP.java  15 Mar 2005 15:11:25 -  1.52.2.11
  +++ FTP.java  19 May 2005 08:54:51 -  1.52.2.12
  @@ -1580,9 +1580,9 @@
   long localTimestamp = localFile.lastModified();
   
   if (this.action == SEND_FILES) {
  -return remoteTimestamp + timeDiffMillis  localTimestamp;
  +return remoteTimestamp + timeDiffMillis = localTimestamp;
   } else {
  -return localTimestamp  remoteTimestamp + timeDiffMillis;
  +return localTimestamp = remoteTimestamp + timeDiffMillis;
   }
   }
   
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2005-05-13 Thread scohen
scohen  2005/05/13 03:34:40

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  improve clarity of what FTPConfigurator is doing.
  
  Revision  ChangesPath
  1.70  +3 -7  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- FTP.java  13 May 2005 10:26:20 -  1.69
  +++ FTP.java  13 May 2005 10:34:40 -  1.70
  @@ -2067,12 +2067,6 @@
   }
   }
   
  -private void configure(FTPClient ftp) {
  -if (this.isConfigurationSet) {
  -FTPConfigurator.configure(ftp, this);
  -}
  -}
  -
   /**
* Runs the task.
*
  @@ -2088,7 +2082,9 @@
   log(Opening FTP connection to  + server, Project.MSG_VERBOSE);
   
   ftp = new FTPClient();
  -configure(ftp);
  +if (this.isConfigurationSet) {
  +ftp = FTPConfigurator.configure(ftp, this);
  +}
   
   ftp.connect(server, port);
   if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2005-03-15 Thread bodewig
bodewig 2005/03/15 07:11:25

  Modified:src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
MacroDef.java
   src/main/org/apache/tools/ant/taskdefs/optional/net Tag:
ANT_16_BRANCH FTP.java
  Log:
  2005
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.7.2.21  +1 -1  ant/src/main/org/apache/tools/ant/taskdefs/MacroDef.java
  
  Index: MacroDef.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/MacroDef.java,v
  retrieving revision 1.7.2.20
  retrieving revision 1.7.2.21
  diff -u -r1.7.2.20 -r1.7.2.21
  --- MacroDef.java 15 Mar 2005 13:36:23 -  1.7.2.20
  +++ MacroDef.java 15 Mar 2005 15:11:24 -  1.7.2.21
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2003-2004 The Apache Software Foundation
  + * Copyright  2003-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the License);
*  you may not use this file except in compliance with the License.
  
  
  
  No   revision
  No   revision
  1.52.2.11 +1 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.52.2.10
  retrieving revision 1.52.2.11
  diff -u -r1.52.2.10 -r1.52.2.11
  --- FTP.java  14 Mar 2005 19:20:13 -  1.52.2.10
  +++ FTP.java  15 Mar 2005 15:11:25 -  1.52.2.11
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2000-2004 The Apache Software Foundation
  + * Copyright  2000-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the License);
*  you may not use this file except in compliance with the License.
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2005-03-14 Thread jkf
jkf 2005/03/14 11:19:20

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  PR: 28797
  
  FTP list command could crash with an ArrayIndexOutOfBoundsException.
  
  Revision  ChangesPath
  1.66  +19 -16
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- FTP.java  4 Mar 2005 22:31:40 -   1.65
  +++ FTP.java  14 Mar 2005 19:19:20 -  1.66
  @@ -1861,31 +1861,34 @@
* @throws BuildException in unknown circumstances
*/
   protected void listFile(FTPClient ftp, BufferedWriter bw, String 
filename)
  - throws IOException, BuildException {
  +throws IOException, BuildException {
   if (verbose) {
   log(listing  + filename);
   }
  +FTPFile[] ftpfiles = ftp.listFiles(resolveFile(filename));
   
  -FTPFile ftpfile = ftp.listFiles(resolveFile(filename))[0];
  -
  -bw.write(ftpfile.toString());
  -bw.newLine();
  -
  -transferred++;
  +if (ftpfiles != null  ftpfiles.length  0) {
  +bw.write(ftpfiles[0].toString());
  +bw.newLine();
  +transferred++;
  +}
   }
   
   
   /**
* Create the specified directory on the remote host.
  - *
  - * @param ftp The FTP client connection
  - * @param dir The directory to create (format must be correct for host
  - *  type)
  - * @throws IOException  in unknown circumstances
  - * @throws BuildException if ignoreNoncriticalErrors has not been set to 
true
  - * and a directory could not be created, for instance because it 
was
  - * already existing. Precisely, the codes 521, 550 and 553 will 
trigger
  - * a BuildException
  + * 
  + * @param ftp
  + *The FTP client connection
  + * @param dir
  + *The directory to create (format must be correct for host 
type)
  + * @throws IOException
  + * in unknown circumstances
  + * @throws BuildException
  + * if ignoreNoncriticalErrors has not been set to true and a
  + * directory could not be created, for instance because it 
was
  + * already existing. Precisely, the codes 521, 550 and 553 
will
  + * trigger a BuildException
*/
   protected void makeRemoteDir(FTPClient ftp, String dir)
throws IOException, BuildException {
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2005-03-14 Thread jkf
jkf 2005/03/14 11:24:58

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  Restored javadoc in the original format.
  
  Revision  ChangesPath
  1.67  +9 -12 
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- FTP.java  14 Mar 2005 19:19:20 -  1.66
  +++ FTP.java  14 Mar 2005 19:24:58 -  1.67
  @@ -1877,18 +1877,15 @@
   
   /**
* Create the specified directory on the remote host.
  - * 
  - * @param ftp
  - *The FTP client connection
  - * @param dir
  - *The directory to create (format must be correct for host 
type)
  - * @throws IOException
  - * in unknown circumstances
  - * @throws BuildException
  - * if ignoreNoncriticalErrors has not been set to true and a
  - * directory could not be created, for instance because it 
was
  - * already existing. Precisely, the codes 521, 550 and 553 
will
  - * trigger a BuildException
  + *
  + * @param ftp The FTP client connection
  + * @param dir The directory to create (format must be correct for host
  + *  type)
  + * @throws IOException  in unknown circumstances
  + * @throws BuildException if ignoreNoncriticalErrors has not been set to 
true
  + * and a directory could not be created, for instance because it 
was
  + * already existing. Precisely, the codes 521, 550 and 553 will 
trigger
  + * a BuildException
*/
   protected void makeRemoteDir(FTPClient ftp, String dir)
throws IOException, BuildException {
  
  
  

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



RE: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2005-02-21 Thread Dominique Devienne
 -Original Message-
 From: Stefan Bodewig [mailto:[EMAIL PROTECTED]
 
 On 18 Feb 2005, [EMAIL PROTECTED] wrote:
 
I'm tempted to retrofit Task.bindToOwner back to the 1.6.x
codebase, for the benefit of third party tasks; same for the extra
constructors for exec and java. Thoughts?
 
 If you only port bindToOwner and the new constructors, but not all the
 points of invocation then you can't do much harm.

FWIW, just one nit about bindToOwner(), but a bit late since I saw the
commit like everyone else.

I would have reversed Steve's bindee.bindToOwner(owner) logic into
owner.configureHelper(helper), which then allows configureHelper to be
protected. It's basically the same, but avoids the public method which
then anyone can call on any task, and it's closer to the code I posted a
few times, and that I'll post again below.

Note also that my code init()s the helper task too, and that I was
always calling configureTask() in the parent task own init(). --DD

/**
 * Configures a helper task to be used within another task.
 *
 * @param  parent the parent (custom) task using the helper task.
 * @param  helper the helper task to configure for use.
 * @return the configured helper task for call chaining.
 */
public static Task configureTask(Task parent, Task helper) {
// Make helper share attributes of the parent
helper.setProject(parent.getProject());
helper.setTaskName(parent.getTaskName());
helper.setOwningTarget(parent.getOwningTarget());

// Copy location for better troubleshooting of subtask
Location location = parent.getLocation();
if (location == null) {
location = Location.UNKNOWN_LOCATION;
}
helper.setLocation(location);

// Initialize (and return) the helper
helper.init();
return helper;
}


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



Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2005-02-21 Thread Steve Loughran
Dominique Devienne wrote:
-Original Message-
From: Stefan Bodewig [mailto:[EMAIL PROTECTED]
On 18 Feb 2005, [EMAIL PROTECTED] wrote:

 I'm tempted to retrofit Task.bindToOwner back to the 1.6.x
 codebase, for the benefit of third party tasks; same for the extra
 constructors for exec and java. Thoughts?
If you only port bindToOwner and the new constructors, but not all the
points of invocation then you can't do much harm.

FWIW, just one nit about bindToOwner(), but a bit late since I saw the
commit like everyone else.
sorry, I did it while I was offline for a week.

I would have reversed Steve's bindee.bindToOwner(owner) logic into
owner.configureHelper(helper), which then allows configureHelper to be
protected. It's basically the same, but avoids the public method which
then anyone can call on any task, and it's closer to the code I posted a
few times, and that I'll post again below.
I hadnt see that; like your location fixup though.
the reason I stuck in the task, is it lets a task add its own 
bindToOwner implementation, to do extra binding. If you put it in the 
parent, then the bound task doesnt get a look in.

Make sense?
Note also that my code init()s the helper task too, and that I was
always calling configureTask() in the parent task own init(). --DD
/**
 * Configures a helper task to be used within another task.
 *
 * @param  parent the parent (custom) task using the helper task.
 * @param  helper the helper task to configure for use.
 * @return the configured helper task for call chaining.
 */
public static Task configureTask(Task parent, Task helper) {
// Make helper share attributes of the parent
helper.setProject(parent.getProject());
helper.setTaskName(parent.getTaskName());
helper.setOwningTarget(parent.getOwningTarget());
// Copy location for better troubleshooting of subtask
Location location = parent.getLocation();
if (location == null) {
location = Location.UNKNOWN_LOCATION;
}
helper.setLocation(location);
// Initialize (and return) the helper
helper.init();
return helper;
}

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


RE: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2005-02-21 Thread Dominique Devienne
 From: Steve Loughran [mailto:[EMAIL PROTECTED]
 the reason I stuck in the task, is it lets a task add its own
 bindToOwner implementation, to do extra binding. If you put it in the
 parent, then the bound task doesnt get a look in.
 
 Make sense?

Not really ;-) Do you have any example of such a thing?

Sounds like me like it breaks encapsulation, no? A task should not have
to know whether it's used directly or not in my view.

Then again I tend to button things down tight as a habit. It always
easier to loosen things a bit later, than the reverse, especially with
Ant's BC requirements.

All that said, thanks for doing this. You're new bindToOwner() does help
encapsulation. We can now easily copy more attributes in just one place
in the future. --DD

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



Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2005-02-19 Thread Stefan Bodewig
On 18 Feb 2005, [EMAIL PROTECTED] wrote:

   I'm tempted to retrofit Task.bindToOwner back to the 1.6.x
   codebase, for the benefit of third party tasks; same for the extra
   constructors for exec and java. Thoughts?

If you only port bindToOwner and the new constructors, but not all the
points of invocation then you can't do much harm.

Stefan

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2005-02-18 Thread stevel
stevel  2005/02/18 15:28:00

  Modified:
src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers
AntResolver.java URLResolver.java
   src/main/org/apache/tools/ant/taskdefs GenerateKey.java
SubAnt.java Ant.java CallTarget.java SignJar.java
LoadProperties.java
   src/main/org/apache/tools/ant/taskdefs/optional/j2ee
WebLogicHotDeploymentTool.java
GenericHotDeploymentTool.java
   src/main/org/apache/tools/ant/taskdefs/optional/clearcase
ClearCase.java
   src/main/org/apache/tools/ant/taskdefs/optional
IContract.java Cab.java RenameExtensions.java
   src/main/org/apache/tools/ant/taskdefs/optional/ejb
WLRun.java BorlandGenerateClient.java
DDCreator.java WLStop.java
WeblogicDeploymentTool.java
BorlandDeploymentTool.java JonasDeploymentTool.java
Ejbc.java WebsphereDeploymentTool.java
   src/main/org/apache/tools/ant/taskdefs/optional/jsp
WLJspc.java
   src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers
JasperC.java
   src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  This commit eliminates all (but one) use of Project.createTask(some name) 
from the codebase. It also sets up all created tasks using the new 
Task.bindToOwner call. 
  
  I'm tempted to retrofit Task.bindToOwner back to the 1.6.x codebase, for the 
benefit of third party tasks; same for the extra constructors for exec and 
java. Thoughts?
  
  Revision  ChangesPath
  1.12  +4 -3  
ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java
  
  Index: AntResolver.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AntResolver.java  10 Dec 2004 10:58:19 -  1.11
  +++ AntResolver.java  18 Feb 2005 23:27:58 -  1.12
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2002-2004 The Apache Software Foundation
  + * Copyright  2002-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the License);
*  you may not use this file except in compliance with the License.
  @@ -69,7 +69,8 @@
final Project project) throws BuildException {
   validate();
   
  -final Ant ant = (Ant) project.createTask(ant);
  +final Ant ant = new Ant();
  +ant.setProject(project);
   ant.setInheritAll(false);
   ant.setAntfile(antfile.getName());
   
  
  
  
  1.12  +4 -3  
ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java
  
  Index: URLResolver.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- URLResolver.java  10 Dec 2004 10:58:19 -  1.11
  +++ URLResolver.java  18 Feb 2005 23:27:59 -  1.12
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2002,2004 The Apache Software Foundation
  + * Copyright  2002,2004-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the License);
*  you may not use this file except in compliance with the License.
  @@ -71,7 +71,8 @@
   
   final File file = getDest();
   
  -final Get get = (Get) project.createTask(get);
  +final Get get = new Get();
  +get.setProject(project);
   get.setDest(file);
   get.setSrc(url);
   get.execute();
  
  
  
  1.29  +2 -2  
ant/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java
  
  Index: GenerateKey.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- GenerateKey.java  4 Jun 2004 07:44:54 -   1.28
  +++ GenerateKey.java  18 Feb 2005 23:27:59 -  1.29
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2000,2002,2004 The Apache Software Foundation
  + * Copyright  2000,2002,2004-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the License);
*  you may not use this file except in compliance with the License.
  @@ -354,7 +354,7 @@
   }
   
   log(Generating Key for  + alias);
  -final ExecTask cmd = 

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2004-12-11 Thread jkf
jkf 2004/12/11 14:43:05

  Modified:src/main/org/apache/tools/ant/util FileUtils.java
   src/main/org/apache/tools/ant/taskdefs Zip.java FixCRLF.java
Copy.java Expand.java Move.java Available.java
XSLTProcess.java Concat.java
   src/testcases/org/apache/tools/ant/taskdefs
XmlPropertyTest.java
   src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  If we can use File.getParentFile, there is presumably no reason to use 
FileUtils.getParentFile, right?
  (Comment re-used from jglick)
  
  Revision  ChangesPath
  1.77  +4 -4  ant/src/main/org/apache/tools/ant/util/FileUtils.java
  
  Index: FileUtils.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/FileUtils.java,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- FileUtils.java10 Dec 2004 23:18:22 -  1.76
  +++ FileUtils.java11 Dec 2004 22:43:04 -  1.77
  @@ -507,7 +507,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 != null  !parent.exists()) {
   parent.mkdirs();
   }
  @@ -709,7 +709,7 @@
   while (tok.hasMoreTokens()) {
   String part = tok.nextToken();
   if (part.equals(..)) {
  -helpFile = getParentFile(helpFile);
  +helpFile = helpFile.getParentFile();
   if (helpFile == null) {
   String msg = The file or path you specified (
   + filename + ) is invalid relative to 
  @@ -1260,7 +1260,7 @@
   throw new IOException(Failed to delete  + to
 +  while trying to rename  + from);
   }
  -File parent = getParentFile(to);
  +File parent = to.getParentFile();
   if (parent != null  !parent.exists()  !parent.mkdirs()) {
   throw new IOException(Failed to create directory  + parent
 +  while trying to rename  + from);
  
  
  
  1.130 +1 -1  ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
  
  Index: Zip.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
  retrieving revision 1.129
  retrieving revision 1.130
  diff -u -r1.129 -r1.130
  --- Zip.java  22 Nov 2004 09:23:28 -  1.129
  +++ Zip.java  11 Dec 2004 22:43:05 -  1.130
  @@ -407,7 +407,7 @@
   if (doUpdate) {
   renamedFile =
   fileUtils.createTempFile(zip, .tmp,
  - 
fileUtils.getParentFile(zipFile));
  + zipFile.getParentFile());
   renamedFile.deleteOnExit();
   
   try {
  
  
  
  1.62  +2 -1  ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
  
  Index: FixCRLF.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- FixCRLF.java  12 Nov 2004 15:14:59 -  1.61
  +++ FixCRLF.java  11 Dec 2004 22:43:05 -  1.62
  @@ -1000,3 +1000,4 @@
   }
   
   }
  +
  
  
  
  1.77  +2 -2  ant/src/main/org/apache/tools/ant/taskdefs/Copy.java
  
  Index: Copy.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Copy.java,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- Copy.java 6 Dec 2004 19:27:13 -   1.76
  +++ Copy.java 11 Dec 2004 22:43:05 -  1.77
  @@ -509,7 +509,7 @@
   }
   
   if (destFile != null) {
  -destDir = fileUtils.getParentFile(destFile);
  +destDir = destFile.getParentFile();
   }
   
   }
  
  
  
  1.57  +1 -1  ant/src/main/org/apache/tools/ant/taskdefs/Expand.java
  
  Index: Expand.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Expand.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- Expand.java   6 Dec 2004 19:27:13 -   1.56
  +++ Expand.java   11 Dec 2004 22:43:05 -  1.57
  @@ -241,7 +241,7 @@
   log(expanding  + entryName +  to  + f,
   Project.MSG_VERBOSE);
   // create intermediary directories - 

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2004-08-23 Thread antoine
antoine 2004/08/23 13:27:37

  Modified:.WHATSNEW
   src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  FTP getTimeDiff was returning wrong value
  PR: 30595
  
  Revision  ChangesPath
  1.652 +2 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.651
  retrieving revision 1.652
  diff -u -r1.651 -r1.652
  --- WHATSNEW  23 Aug 2004 14:15:05 -  1.651
  +++ WHATSNEW  23 Aug 2004 20:27:37 -  1.652
  @@ -78,6 +78,8 @@
   
   * checksum fileext property doc wrong. Bugzilla 30787.
   
  +* FTP task, getTimeDiff method was returning wrong value. Bugzilla 30595.
  +
   Changes from Ant 1.6.1 to Ant 1.6.2
   ===
   
  
  
  
  1.61  +1 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- FTP.java  9 Mar 2004 16:48:32 -   1.60
  +++ FTP.java  23 Aug 2004 20:27:37 -  1.61
  @@ -1497,7 +1497,7 @@
   FTPFile [] ftpFiles = ftp.listFiles(tempFile.getName());
   if (ftpFiles.length == 1) {
   long remoteTimeStamp = 
ftpFiles[0].getTimestamp().getTime().getTime();
  -returnValue = remoteTimeStamp - localTimeStamp;
  +returnValue = localTimeStamp - remoteTimeStamp;
   }
   ftp.deleteFile(ftpFiles[0].getName());
   }
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2004-08-23 Thread antoine
antoine 2004/08/23 13:30:44

  Modified:.Tag: ANT_16_BRANCH WHATSNEW
   src/main/org/apache/tools/ant/taskdefs/optional/net Tag:
ANT_16_BRANCH FTP.java
  Log:
  FTP tas, getTimeDiff was returning wrong value
  PR: 30595
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.503.2.129 +2 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.128
  retrieving revision 1.503.2.129
  diff -u -r1.503.2.128 -r1.503.2.129
  --- WHATSNEW  23 Aug 2004 14:15:46 -  1.503.2.128
  +++ WHATSNEW  23 Aug 2004 20:30:44 -  1.503.2.129
  @@ -32,6 +32,8 @@
   
   * checksum fileext property doc wrong. Bugzilla 30787.
   
  +* FTP task, getTimeDiff method was returning wrong value. Bugzilla 30595.
  +
   Changes from Ant 1.6.1 to Ant 1.6.2
   ===
   
  
  
  
  No   revision
  No   revision
  1.52.2.9  +1 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.52.2.8
  retrieving revision 1.52.2.9
  diff -u -r1.52.2.8 -r1.52.2.9
  --- FTP.java  9 Mar 2004 17:01:51 -   1.52.2.8
  +++ FTP.java  23 Aug 2004 20:30:44 -  1.52.2.9
  @@ -1497,7 +1497,7 @@
   FTPFile [] ftpFiles = ftp.listFiles(tempFile.getName());
   if (ftpFiles.length == 1) {
   long remoteTimeStamp = 
ftpFiles[0].getTimestamp().getTime().getTime();
  -returnValue = remoteTimeStamp - localTimeStamp;
  +returnValue = localTimeStamp - remoteTimeStamp;
   }
   ftp.deleteFile(ftpFiles[0].getName());
   }
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-11-05 Thread antoine
antoine 2003/11/05 14:00:56

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  Prevent NPE in method CheckRemoteSensitivity
  PR: 24440
  
  Revision  ChangesPath
  1.56  +3 -0  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- FTP.java  15 Oct 2003 18:49:53 -  1.55
  +++ FTP.java  5 Nov 2003 22:00:56 -   1.56
  @@ -561,6 +561,9 @@
   return listFiles(directory, true);
   }
   private void checkRemoteSensitivity(FTPFile[] array, String 
directory) {
  +if (array == null) {
  +return;
  +}
   boolean candidateFound = false;
   String target = null;
   for (int icounter = 0; icounter  array.length; icounter++) {
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-11-05 Thread antoine
antoine 2003/11/05 14:03:40

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net Tag:
ANT_16_BRANCH FTP.java
  Log:
  Merge from HEAD
  Prevent NPE in checkRemoteSensitivity
  PR: 24440
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.52.2.4  +3 -0  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.52.2.3
  retrieving revision 1.52.2.4
  diff -u -r1.52.2.3 -r1.52.2.4
  --- FTP.java  15 Oct 2003 18:45:12 -  1.52.2.3
  +++ FTP.java  5 Nov 2003 22:03:40 -   1.52.2.4
  @@ -561,6 +561,9 @@
   return listFiles(directory, true);
   }
   private void checkRemoteSensitivity(FTPFile[] array, String 
directory) {
  +if (array == null) {
  +return;
  +}
   boolean candidateFound = false;
   String target = null;
   for (int icounter = 0; icounter  array.length; icounter++) {
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-10-15 Thread antoine
antoine 2003/10/15 11:45:13

  Modified:src/testcases/org/apache/tools/ant/taskdefs/optional/net
Tag: ANT_16_BRANCH FTPTest.java
   src/etc/testcases/taskdefs/optional/net Tag: ANT_16_BRANCH
ftp.xml
   src/main/org/apache/tools/ant/taskdefs/optional/net Tag:
ANT_16_BRANCH FTP.java
  Log:
  Fix problem with ftp scanning when remotedir is not absolute
  I improved the test cases parallel to that, but there is no specific testcase
  for this problem, because I did not know how to write (ie I do not know what 
to
  expect in the ftp default directory. Some ftp servers will be configured to 
default
  to the home directory of the ftp user, or to default to the root of the 
server's file system).
  PR: 23833
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.8.2.2   +5 -0  
ant/src/testcases/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
  
  Index: FTPTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java,v
  retrieving revision 1.8.2.1
  retrieving revision 1.8.2.2
  diff -u -r1.8.2.1 -r1.8.2.2
  --- FTPTest.java  13 Oct 2003 19:37:01 -  1.8.2.1
  +++ FTPTest.java  15 Oct 2003 18:45:12 -  1.8.2.2
  @@ -113,6 +113,11 @@
   }
   
   public void tearDown() {
  +try {
  +ftp.disconnect();
  +} catch (IOException ioe) {
  +// do nothing
  +}
   getProject().executeTarget(cleanup);
   }
   private boolean changeRemoteDir(String remoteDir) {
  
  
  
  No   revision
  No   revision
  1.5.2.2   +6 -1  ant/src/etc/testcases/taskdefs/optional/net/ftp.xml
  
  Index: ftp.xml
  ===
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/optional/net/ftp.xml,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- ftp.xml   13 Oct 2003 19:37:02 -  1.5.2.1
  +++ ftp.xml   15 Oct 2003 18:45:12 -  1.5.2.2
  @@ -4,9 +4,9 @@
   property name=ftp.host value=localhost/
   property name=ftp.port value=21 /
   property name=ftp.password value=sunshine /
  +property name=ftp.filesep value=//
   property name=tmp.dir location=tmp/
   property name=tmp.get.dir location=tmp.get/
  -property name=ftp.filesep value=//
   fileset dir=${tmp.get.dir} id=fileset-destination-with-selector
   include name=alpha/**/
   filename name=**/alpha.xml /
  @@ -34,6 +34,7 @@
   server=${ftp.host}
   userid=${ftp.user}
   password=${ftp.password}
  +separator=${ftp.filesep}
   remotedir=${tmp.dir}
   fileset refid=fileset-destination-with-selector/
   /ftp
  @@ -57,6 +58,7 @@
   server=${ftp.host}
   userid=${ftp.user}
   password=${ftp.password}
  +separator=${ftp.filesep}
   remotedir=${tmp.dir}
   
   fileset refid=fileset-destination-followsymlinks/
  @@ -67,6 +69,7 @@
   server=${ftp.host}
   userid=${ftp.user}
   password=${ftp.password}
  +separator=${ftp.filesep}
   remotedir=${tmp.dir}
   
   fileset refid=fileset-destination-nofollowsymlinks/
  @@ -85,6 +88,7 @@
   server=${ftp.host}
   userid=${ftp.user}
   password=${ftp.password}
  +separator=${ftp.filesep}
   remotedir=${tmp.dir}
   fileset dir=${tmp.get.dir}
   include name=**/
  @@ -94,6 +98,7 @@
   server=${ftp.host}
   userid=${ftp.user}
   password=${ftp.password}
  +separator=${ftp.filesep}
   remotedir=${tmp.dir}
   fileset dir=${tmp.get.dir}
   include name=**/
  
  
  
  No   revision
  No   revision
  1.52.2.3  +1 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.52.2.2
  retrieving revision 1.52.2.3
  diff -u -r1.52.2.2 -r1.52.2.3
  --- FTP.java  14 Oct 2003 13:20:12 -  1.52.2.2
  +++ FTP.java  15 Oct 2003 18:45:12 -  1.52.2.3
  @@ -273,7 +273,7 @@
   // construct it
   if (newroots.containsKey()) {
   // we are going to scan everything anyway
  -scandir(remotedir, , true);
  +scandir(rootPath, , true);
   } else {
   

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-10-15 Thread antoine
antoine 2003/10/15 11:49:54

  Modified:src/testcases/org/apache/tools/ant/taskdefs/optional/net
FTPTest.java
   src/etc/testcases/taskdefs/optional/net ftp.xml
   src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  Merge from ANT_16_BRANCH
  Fix problem with non absolute remote dirs
  PR: 23833
  
  Revision  ChangesPath
  1.10  +5 -0  
ant/src/testcases/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
  
  Index: FTPTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- FTPTest.java  13 Oct 2003 19:53:01 -  1.9
  +++ FTPTest.java  15 Oct 2003 18:49:53 -  1.10
  @@ -113,6 +113,11 @@
   }
   
   public void tearDown() {
  +try {
  +ftp.disconnect();
  +} catch (IOException ioe) {
  +// do nothing
  +}
   getProject().executeTarget(cleanup);
   }
   private boolean changeRemoteDir(String remoteDir) {
  
  
  
  1.7   +4 -1  ant/src/etc/testcases/taskdefs/optional/net/ftp.xml
  
  Index: ftp.xml
  ===
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/optional/net/ftp.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ftp.xml   13 Oct 2003 19:53:01 -  1.6
  +++ ftp.xml   15 Oct 2003 18:49:53 -  1.7
  @@ -4,9 +4,9 @@
   property name=ftp.host value=localhost/
   property name=ftp.port value=21 /
   property name=ftp.password value=sunshine /
  +property name=ftp.filesep value=//
   property name=tmp.dir location=tmp/
   property name=tmp.get.dir location=tmp.get/
  -property name=ftp.filesep value=//
   fileset dir=${tmp.get.dir} id=fileset-destination-with-selector
   include name=alpha/**/
   filename name=**/alpha.xml /
  @@ -34,6 +34,7 @@
   server=${ftp.host}
   userid=${ftp.user}
   password=${ftp.password}
  +separator=${ftp.filesep}
   remotedir=${tmp.dir}
   fileset refid=fileset-destination-with-selector/
   /ftp
  @@ -57,6 +58,7 @@
   server=${ftp.host}
   userid=${ftp.user}
   password=${ftp.password}
  +separator=${ftp.filesep}
   remotedir=${tmp.dir}
   
   fileset refid=fileset-destination-followsymlinks/
  @@ -67,6 +69,7 @@
   server=${ftp.host}
   userid=${ftp.user}
   password=${ftp.password}
  +separator=${ftp.filesep}
   remotedir=${tmp.dir}
   
   fileset refid=fileset-destination-nofollowsymlinks/
  
  
  
  1.55  +1 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- FTP.java  14 Oct 2003 13:19:53 -  1.54
  +++ FTP.java  15 Oct 2003 18:49:53 -  1.55
  @@ -273,7 +273,7 @@
   // construct it
   if (newroots.containsKey()) {
   // we are going to scan everything anyway
  -scandir(remotedir, , true);
  +scandir(rootPath, , true);
   } else {
   // only scan directories that can include matched files or
   // directories
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-09-12 Thread antoine
antoine 2003/09/12 13:32:29

  Modified:.WHATSNEW
   src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  send the filename in the proper remote format in the site command done
  to chmod a file after a put
  PR: 23143
  
  Revision  ChangesPath
  1.498 +3 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.497
  retrieving revision 1.498
  diff -u -r1.497 -r1.498
  --- WHATSNEW  10 Sep 2003 18:20:45 -  1.497
  +++ WHATSNEW  12 Sep 2003 20:32:29 -  1.498
  @@ -219,6 +219,9 @@
   * ftp chmod failed when the remote system was UNIX and local system Windows
 Bugzilla Report 21865.
   
  +* ftp put with chmod failed when the remote system was UNIX and local system 
Windows
  +  Bugzilla Report 23143.
  +
   * ftp did not set the ascii mode explicity, causing problems with ftp servers
 having binary as default
   
  
  
  
  1.52  +1 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- FTP.java  22 Aug 2003 11:23:48 -  1.51
  +++ FTP.java  12 Sep 2003 20:32:29 -  1.52
  @@ -1706,7 +1706,7 @@
   } else {
   // see if we should issue a chmod command
   if (chmod != null) {
  -doSiteCommand(ftp, chmod  + chmod +   + filename);
  +doSiteCommand(ftp, chmod  + chmod +   + 
resolveFile(filename));
   }
   log(File  + file.getAbsolutePath() +  copied to  + 
server,
   Project.MSG_VERBOSE);
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-08-21 Thread antoine
antoine 2003/08/21 09:56:12

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  Optimize scanning in FTP.FTPDirectoryScanner, using similar algorithms
  to the ones introduced in DirectoryScanner.
  There is a gain when
  - the include patterns look like some/very/long/path
  - the remote file system is case sensitive
  - the casesensitive and followsymlinks options of the fileset are set
  to true (the default)
  PR: 20103
  
  Revision  ChangesPath
  1.50  +613 -31   
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- FTP.java  14 Aug 2003 21:01:43 -  1.49
  +++ FTP.java  21 Aug 2003 16:56:12 -  1.50
  @@ -66,9 +66,16 @@
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.OutputStream;
  +import java.util.Enumeration;
  +import java.util.HashMap;
  +import java.util.Hashtable;
  +import java.util.HashSet;
   import java.util.Locale;
  +import java.util.Map;
  +import java.util.Set;
   import java.util.StringTokenizer;
   import java.util.Vector;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.DirectoryScanner;
   import org.apache.tools.ant.Project;
  @@ -76,6 +83,7 @@
   import org.apache.tools.ant.taskdefs.Delete;
   import org.apache.tools.ant.types.EnumeratedAttribute;
   import org.apache.tools.ant.types.FileSet;
  +import org.apache.tools.ant.types.selectors.SelectorUtils;
   import org.apache.tools.ant.util.FileUtils;
   
   /**
  @@ -185,7 +193,13 @@
*/
   protected class FTPDirectoryScanner extends DirectoryScanner {
   protected FTPClient ftp = null;
  -
  +private String rootPath = null;
  +/**
  + * since ant 1.6
  + * this flag should be set to true on UNIX and can save scanning time
  + */
  +private boolean remoteSystemCaseSensitive = false;
  +private boolean remoteSensitivityChecked = false;
   
   /**
* constructor
  @@ -223,7 +237,8 @@
   String cwd = ftp.printWorkingDirectory();
   // always start from the current ftp working dir
   
  -scandir(., , true);
  +checkIncludePatterns();
  +clearCaches();
   ftp.changeWorkingDirectory(cwd);
   } catch (IOException e) {
   throw new BuildException(Unable to scan FTP server: , e);
  @@ -232,6 +247,106 @@
   
   
   /**
  + * this routine is actually checking all the include patterns in
  + * order to avoid scanning everything under base dir
  + * @since ant1.6
  + */
  +private void checkIncludePatterns() {
  +Hashtable newroots = new Hashtable();
  +// put in the newroots vector the include patterns without
  +// wildcard tokens
  +for (int icounter = 0; icounter  includes.length; icounter++) {
  +String newpattern =
  +SelectorUtils.rtrimWildcardTokens(includes[icounter]);
  +newroots.put(newpattern, includes[icounter]);
  +}
  +if (remotedir == null) {
  +try {
  +remotedir = ftp.printWorkingDirectory();
  +} catch (IOException e) {
  +throw new BuildException(could not read current ftp 
directory,
  +getLocation());
  +}
  +}
  +AntFTPFile baseFTPFile = new AntFTPRootFile(ftp, remotedir);
  +rootPath = baseFTPFile.getAbsolutePath();
  +// construct it
  +if (newroots.containsKey()) {
  +// we are going to scan everything anyway
  +scandir(remotedir, , true);
  +} else {
  +// only scan directories that can include matched files or
  +// directories
  +Enumeration enum2 = newroots.keys();
  +
  +while (enum2.hasMoreElements()) {
  +String currentelement = (String) enum2.nextElement();
  +String originalpattern = (String) 
newroots.get(currentelement);
  +AntFTPFile myfile = new AntFTPFile(baseFTPFile, 
currentelement);
  +boolean isOK = true;
  +boolean traversesSymlinks = false;
  +String path = null;
  +
  +if (myfile.exists()) {
  +if (remoteSensitivityChecked
  + remoteSystemCaseSensitive  
isFollowSymlinks()) {
  +// cool case,
  +//we 

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-08-14 Thread antoine
antoine 2003/08/14 04:37:36

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  files which are pointed to by symbolic links should be excluded if 
followsymlinks=false
  
  Revision  ChangesPath
  1.46  +4 -3  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- FTP.java  7 Aug 2003 22:23:35 -   1.45
  +++ FTP.java  14 Aug 2003 11:37:36 -  1.46
  @@ -290,9 +290,10 @@
   name + File.separator, fast);
   }
   } else {
  -if (isFunctioningAsFile(ftp, dir, file)) {
  -String name = vpath + file.getName();
  -
  +String name = vpath + file.getName();
  +if (!isFollowSymlinks()  
file.isSymbolicLink()) {
  +dirsExcluded.addElement(name);
  +} else if (isFunctioningAsFile(ftp, dir, file)) {
   if (isIncluded(name)) {
   if (!isExcluded(name)) {
   filesIncluded.addElement(name);
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-08-14 Thread antoine
antoine 2003/08/14 08:47:37

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  mistake found ... oops ... corrected
  
  Revision  ChangesPath
  1.48  +1 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- FTP.java  14 Aug 2003 14:47:54 -  1.47
  +++ FTP.java  14 Aug 2003 15:47:37 -  1.48
  @@ -291,7 +291,7 @@
   } else {
   String name = vpath + file.getName();
   if (!isFollowSymlinks()  
file.isSymbolicLink()) {
  -dirsExcluded.addElement(name);
  +filesExcluded.addElement(name);
   } else if (isFunctioningAsFile(ftp, dir, file)) {
   if (isIncluded(name)) {
   if (!isExcluded(name)) {
  
  
  

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



Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-08-12 Thread Gus Heck
Antoine,
Since you have recently been playing with symlinks/FTP what are your 
thoughts on bug 14320?

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14320
-Gus
Stefan Bodewig wrote:
On Wed, 6 Aug 2003, Antoine Levy-Lambert [EMAIL PROTECTED] wrote:
 

1) concerning the inclusion of  in includedDirectories
   1a) change the implementation of RM_DIR
   in order not to delete the root dir of the fileset
   or
   1b) revert the inclusion of  in includedDirectories and change
   the tests + document the difference with DirectoryScanner
   

or our all time backwards compatibility saving option
1c) add a new attribute to ftp that controls the behavior.
I'm not sure it's worth it, no real opinion other than we shouldn't
break backwards compatibility just to fix something that hasn't been
perceived as broken so far.
 

2) Concerning the symbolic links
   2a) keep the code change and simply mention it in WHATSNEW.
   Then users who do not want to download symbolic link directories
   can
simply set thecorresponding attribute to false.
or
   2b) add a flag in DirectoryScanner#setFollowSymlinks to record
   the fact that follow symlinks has been explicitly set to true,
   and only follow symlinks if the user mentioned it explicitly ?
   

or
2c) call setFollowSymlinks(false) in FTPDirectoryScanner's
constructor.  I.e. change the default value of the attribute and
document it that way.
I'd be in favor of 2c).
Stefan
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


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


Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-08-12 Thread Gus Heck
Antoine,
Since you have recently been playing with symlinks/FTP what are your 
thoughts on bug 14320?

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14320
-Gus
Stefan Bodewig wrote:
On Wed, 6 Aug 2003, Antoine Levy-Lambert [EMAIL PROTECTED] wrote:
 

1) concerning the inclusion of  in includedDirectories
   1a) change the implementation of RM_DIR
   in order not to delete the root dir of the fileset
   or
   1b) revert the inclusion of  in includedDirectories and change
   the tests + document the difference with DirectoryScanner
   

or our all time backwards compatibility saving option
1c) add a new attribute to ftp that controls the behavior.
I'm not sure it's worth it, no real opinion other than we shouldn't
break backwards compatibility just to fix something that hasn't been
perceived as broken so far.
 

2) Concerning the symbolic links
   2a) keep the code change and simply mention it in WHATSNEW.
   Then users who do not want to download symbolic link directories
   can
simply set thecorresponding attribute to false.
or
   2b) add a flag in DirectoryScanner#setFollowSymlinks to record
   the fact that follow symlinks has been explicitly set to true,
   and only follow symlinks if the user mentioned it explicitly ?
   

or
2c) call setFollowSymlinks(false) in FTPDirectoryScanner's
constructor.  I.e. change the default value of the attribute and
document it that way.
I'd be in favor of 2c).
Stefan
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


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


Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-08-12 Thread Antoine Levy-Lambert

- Original Message -
From: Gus Heck [EMAIL PROTECTED]
Sent: Tuesday, August 12, 2003 4:10 PM


 Antoine,

 Since you have recently been playing with symlinks/FTP what are your
 thoughts on bug 14320?

 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14320


First the bad news : I do not have the time to work on this in the frame of
ant 1.6. I am concerned that this might open a large Pandora box. :-(

Once ant 1.6 is released, I would like to discuss again the topic of
Resource(s) and/or Jakarta-Common VFS. I would like to evaluate the use of
Jakarta-Common VFS in ant, so that ant does not need to reinvent the wheel
for everything. Just a thought at the moment, might be wrong.



Then concerning bug 14320 specifically :

Changing followsymlinks=false to preserve symbolic links as symbolic links
would be a breach of behavioral compatibility, not fixing a bug.

The implemented semantics of followsymlinks=false is like an exclude of
the symbolic links ***and*** of the files and directories pointed to by the
symbolic links if they are not covered by another include pattern which
does not use the link.

*** The DirectoryScanner and the tasks that use it (nearly everything that
deals with filesets in ant, or maybe 80% of ant) do not contain any
provision to manipulate symbolic links as links. ***

If the user chooses the option followsymlinks=true in the fileset
definition, which in turn gets transmitted to the fileset in
AbstractFileSet#getDirectoryScanner(Project p), the files and/or directories
*** pointed to by the links *** (not the links themselves ) are manipulated
by the task using FileSet/DirectoryScanner.

The symbolic links *** as such *** are never manipulated on the target side
of a task that I know of (except symlink of course).

Manipulating the symbolic link as a link is doable in a portable way for
packaging tasks (zip, jar, war, ear, tar). I am not sure what is the API to
find the target of the symbolic link (do an exec of ls -L and read the
result, or go the JNI route ?) ...


*** We need another attribute for filesets and directoryscanner called
preservesymlinks. ***
GUS
I can imagine that one could add an atribute that caused an OS check and if
we
it is a *nix set a flag that caused copy to use FileUtils.isSymbolicLink to
identify symlinks. symlinks could then be reproduced in either absolute form
or
minimum relative form or not reproduced in the destination directory based
on an
atribute such as copySymlinksAs=none|absolute|minRelative
I don't know how much time I can put into it, but I'd be willing to try that
if
it sounds like a good idea to anyone else.
/GUS
ANTOINE
Does minRelative mean relative to the root dir of the fileset ?
Maybe asis would be a good option too, to copy somelink - ../../foo/bar
as ../../foo/bar
/ANTOINE


This attribute would only be legal with followsymlinks=false (since true
means manipulate the objects pointed to by the links).

Then we need to define task by task how to use
preservesymlinks/copysimlinks=none|absolute|minRelative
AFAIK
ANT
Symbolic links do not exist in Windows (for ant's FileUtils#isSymbolicLink)
Symbolic links can be created via the symlink task, which relies on ln -s
available in the operating system
/ANT
WINDOWS
.lnk files exist
non .lnk links exist
not aware of command line utility distributed with all versions of the OS to
do this
aware of ln.exe in cygwin
aware of shortcut.exe, a program which is part of the Windows NT resource
kit of Microsoft
/WINDOWS
UNIX
the area where symbolic links support should be least problematic,
except for possible exceptions due to media not accepting symbolic links
/UNIX
/AFAIK


Apart from copy/,  packaging tasks are good candidates for having the
option of copying/preserving symbolic links. They would only be impacted if
they run on UNIX.

Antoine



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



Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-08-12 Thread Gus Heck
Antoine Levy-Lambert wrote:
- Original Message -
From: Gus Heck [EMAIL PROTECTED]
Sent: Tuesday, August 12, 2003 4:10 PM
 

Antoine,
Since you have recently been playing with symlinks/FTP what are your
thoughts on bug 14320?
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14320
   

First the bad news : I do not have the time to work on this in the frame of
ant 1.6. I am concerned that this might open a large Pandora box. :-(
 

Fair enough :)
Once ant 1.6 is released, I would like to discuss again the topic of
Resource(s) and/or Jakarta-Common VFS. I would like to evaluate the use of
Jakarta-Common VFS in ant, so that ant does not need to reinvent the wheel
for everything. Just a thought at the moment, might be wrong.
 

hmm I should find out what Jakarta-Common VFS is :)
snip
Manipulating the symbolic link as a link is doable in a portable way for
packaging tasks (zip, jar, war, ear, tar). I am not sure what is the API to
find the target of the symbolic link (do an exec of ls -L and read the
result, or go the JNI route ?) ...
 

Parsing command line output seems dicey and brittle.
*** We need another attribute for filesets and directoryscanner called
preservesymlinks. ***
GUS
I can imagine that one could add an atribute that caused an OS check and if
we
it is a *nix set a flag that caused copy to use FileUtils.isSymbolicLink to
identify symlinks. symlinks could then be reproduced in either absolute form
or
minimum relative form or not reproduced in the destination directory based
on an
atribute such as copySymlinksAs=none|absolute|minRelative
I don't know how much time I can put into it, but I'd be willing to try that
if
it sounds like a good idea to anyone else.
/GUS
ANTOINE
Does minRelative mean relative to the root dir of the fileset ?
Maybe asis would be a good option too, to copy somelink - ../../foo/bar
as ../../foo/bar
/ANTOINE
 

/usr/local/storage/links/link2foo - /usr/local/storage/gus/baz/bar/foo
is also equivalent to the following
/usr/local/storage/links/lin2foo - 
../../../../user/local/storage/gus/baz/bar/foo
/usr/local/storage/links/lin2foo - ../../../local/storage/gus/baz/bar/foo
/usr/local/storage/links/lin2foo - ../../storage/gus/baz/bar/foo
/usr/local/storage/links/lin2foo - ../gus/baz/bar/foo

The last of these is what I call minRelative. (I don't know if there is 
a more standard term).
I currently convert all links in my website to this form by execing the 
linux command
(not the ant task): symlinks -rcs from the document root twice. The 
first invocation changes absolute to relative, and the second reduces 
the lenghthy links to minimal links. I do not know if this command is 
available on other *nix platforms.

It should also be possible to compare the canoniacal path of the dir the 
link is to be created in and the canonical path of the target of the 
link and calculate the minimum number of ../ 's needed to create the 
link and get minRelative that way.

Maintaining asis requires direct knowledge of which of the 4 
posibilities above was on the file system, and probably does require 
parsing output of ln or ls or whatever. minRelative links are of 
particular to me interest because they are the least likely to break 
when moving directories containing links around. The first of the 4 
relative links always breaks, if it gets moved up or down a level, but 
if I move /usr/local/storage to /usr/local/old/storage then the last two 
forms still work. My website build creates links in a tempdir before 
moving the whole thing to where the world can see it (assuming all went 
well).

This attribute would only be legal with followsymlinks=false (since true
means manipulate the objects pointed to by the links).
Then we need to define task by task how to use
preservesymlinks/copysimlinks=none|absolute|minRelative
AFAIK
ANT
Symbolic links do not exist in Windows (for ant's FileUtils#isSymbolicLink)
Symbolic links can be created via the symlink task, which relies on ln -s
available in the operating system
/ANT
agree
WINDOWS
.lnk files exist
non .lnk links exist
not aware of command line utility distributed with all versions of the OS to
do this
aware of ln.exe in cygwin
aware of shortcut.exe, a program which is part of the Windows NT resource
kit of Microsoft
/WINDOWS
lnk files have substantial functional differences. a .lnk to a directory 
cannot be included in the middle of a path as such: 
C:\projects\ant.lnk\src\main ... this won't work, but of course does 
work with symlinks. I have heard that there is something like symlinks 
out there called reparse points but I really don't know anything other 
than the name. (google searches a year ago wern't too fruitful on the 
topic, but this may have changed).

UNIX
the area where symbolic links support should be least problematic,
except for possible exceptions due to media not accepting symbolic links
/UNIX
/AFAIK
Apart from copy/,  packaging tasks are good candidates for having the
option of copying/preserving symbolic links. They 

Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-08-06 Thread Antoine Levy-Lambert
I have introduced two changes in the behavior of the FTP.FTPDirectoryScanner
to make it behave like the normal DirectoryScanner :

- possibility of following symbolic links which are directories, governed by
the followSymlinks property,

- including  (root directory of the fileset) in the includedDirectories,
as long as it matches include patterns

These 2 changes are introducing behavior changes with ant 1.5.3

The impact of the changes :

- symbolic links : if you are doing a get operation and there is a symbolic
link pointing to a directory in the fileset, then you are going to download
from the link too, whereas you previously would not have

- the inclusion of  in includedDirectories impacts only the action RM_DIR.
I need to check whether it works anyway.

The aim of the exercise was to make FTP.FTPDirectoryScanner pass the same
tests as DirectoryScanner.


My thoughts :

1) concerning the inclusion of  in includedDirectories

1a) change the implementation of RM_DIR
in order not to delete the root dir of the fileset

or

1b) revert the inclusion of  in includedDirectories
and change the tests + document the difference with DirectoryScanner

2) Concerning the symbolic links

2a) keep the code change and simply mention it in WHATSNEW.

Then users who do not want to download symbolic link directories can
simply set thecorresponding attribute to false.

or

2b) add a flag in DirectoryScanner#setFollowSymlinks to record the fact
that follow symlinks  has  been explicitly set to true, and only follow
symlinks if the user mentioned it explicitly ?

What are your thoughts ?

Cheers,

Antoine



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



Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-08-06 Thread J. David Beutel
On Tue, 5 Aug 2003, Steve Loughran wrote:

 That is interesting. Exec() hanging. It is not like chmod is doing much.
 
 No obvious causes spring to mind, but then I dont use freebsd much. 
 (though I could bring it up under vmware, I suppose)

I've had similar problems with JDK 1.4.1 on RedHat 7.2, 
and better luck with 1.4.0_03.

11011011


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



Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-08-06 Thread Antoine Lévy-Lambert
Thanks for the comments Stefan, will do so this evening.
Cheers,
Antoine
- Original Message -
From: Stefan Bodewig [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 9:28 AM
Subject: Re: cvs commit:
ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java


 On Wed, 6 Aug 2003, Antoine Levy-Lambert [EMAIL PROTECTED] wrote:

  1) concerning the inclusion of  in includedDirectories
 
  1a) change the implementation of RM_DIR
  in order not to delete the root dir of the fileset
 
  or
 
  1b) revert the inclusion of  in includedDirectories and change
  the tests + document the difference with DirectoryScanner

 or our all time backwards compatibility saving option

 1c) add a new attribute to ftp that controls the behavior.

 I'm not sure it's worth it, no real opinion other than we shouldn't
 break backwards compatibility just to fix something that hasn't been
 perceived as broken so far.

  2) Concerning the symbolic links
 
  2a) keep the code change and simply mention it in WHATSNEW.
 
  Then users who do not want to download symbolic link directories
  can
  simply set thecorresponding attribute to false.
 
  or
 
  2b) add a flag in DirectoryScanner#setFollowSymlinks to record
  the fact that follow symlinks has been explicitly set to true,
  and only follow symlinks if the user mentioned it explicitly ?

 or

 2c) call setFollowSymlinks(false) in FTPDirectoryScanner's
 constructor.  I.e. change the default value of the attribute and
 document it that way.

 I'd be in favor of 2c).

 Stefan

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





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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-08-05 Thread antoine
antoine 2003/08/05 09:44:43

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  Make the FTP.FTPDirectoryScanner class also register the root of a fileset
  when the root matches include exclude patterns.
  This is the behavior of the DirectoryScanner for normal filesets.
  This change should only possibly impact the RMDIR modus of the ftp task
  when the root directory is included.
  
  Revision  ChangesPath
  1.40  +12 -0 
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- FTP.java  29 Jul 2003 11:19:27 -  1.39
  +++ FTP.java  5 Aug 2003 16:44:43 -   1.40
  @@ -215,7 +215,19 @@
   
   try {
   String cwd = ftp.printWorkingDirectory();
  +// register also the root directory of the fileset if it 
matches
  +// include and exclude patterns
  +if (isIncluded()) {
  +if (!isExcluded()) {
  +dirsIncluded.addElement();
  +} else {
  +dirsExcluded.addElement();
  +}
  +} else {
  +dirsNotIncluded.addElement();
  +}
   // always start from the current ftp working dir
  +
   scandir(., , true);
   ftp.changeWorkingDirectory(cwd);
   } catch (IOException e) {
  
  
  

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



Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-08-05 Thread Steve Loughran
Antoine Levy-Lambert wrote:
Steve,
I am trying to test on cvs.apache.org (FreeBsd and
java version 1.4.1-p3
Java(TM) 2 Runtime Environment, Standard Edition (build
1.4.1-p3-brian_28_jul_2003_12_35)
Java HotSpot(TM) Client VM (build 1.4.1-p3-brian_28_jul_2003_12_35, mixed
mode)
The exec task is hanging out there it seems; at least chmod/ and
symlink/ hang out there.
I wonder whether the JVM which I am using there is worth something ?
Maybe I will try with a JDK 1.3 or 1.2
That is interesting. Exec() hanging. It is not like chmod is doing much.
No obvious causes spring to mind, but then I dont use freebsd much. 
(though I could bring it up under vmware, I suppose)

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


cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-08-05 Thread antoine
antoine 2003/08/05 15:23:57

  Modified:src/main/org/apache/tools/ant DirectoryScanner.java
   src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  Make the FTP.FTPDirectoryScanner behave like the DirectoryScanner
  in terms of following symbolic links which are directories.
  This will make a change of behavior in comparison with ant 1.5.3
  where the behavior of the ftp task was to never follow symbolic links.
  
  Also select symbolic links which are files
  PR: 14063
  
  Revision  ChangesPath
  1.62  +12 -1 ant/src/main/org/apache/tools/ant/DirectoryScanner.java
  
  Index: DirectoryScanner.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/DirectoryScanner.java,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- DirectoryScanner.java 29 Jul 2003 19:47:16 -  1.61
  +++ DirectoryScanner.java 5 Aug 2003 22:23:57 -   1.62
  @@ -514,6 +514,17 @@
   }
   
   /**
  + * gets whether or not a DirectoryScanner follows symbolic links
  + *
  + * @return flag indicating whether symbolic links should be followed
  + *
  + * @since ant 1.6
  + */
  +public boolean isFollowSymlinks() {
  +return followSymlinks;
  +}
  +
  +/**
* Sets whether or not symbolic links should be followed.
*
* @param followSymlinks whether or not symbolic links should be followed
  @@ -1005,7 +1016,7 @@
*/
   private boolean isMorePowerfulThanExcludes(String name, String 
includepattern) {
   String soughtexclude = name + File.separator + **;
  -for (int counter=0; counter excludes.length; counter++) {
  +for (int counter = 0; counter  excludes.length; counter++) {
   if (excludes[counter].equals(soughtexclude))  {
   return false;
   }
  
  
  
  1.41  +82 -8 
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- FTP.java  5 Aug 2003 16:44:43 -   1.40
  +++ FTP.java  5 Aug 2003 22:23:57 -   1.41
  @@ -258,16 +258,24 @@
   
   for (int i = 0; i  newfiles.length; i++) {
   FTPFile file = newfiles[i];
  -
   if (!file.getName().equals(.)
 !file.getName().equals(..)) {
  -if (file.isDirectory()) {
  +if (isFunctioningAsDirectory(ftp, dir, file)) {
   String name = vpath + file.getName();
  -if (isIncluded(name)) {
  +boolean slowScanAllowed = true;
  +if (!isFollowSymlinks()  
file.isSymbolicLink()) {
  +dirsExcluded.addElement(name);
  +slowScanAllowed = false;
  +} else if (isIncluded(name)) {
   if (!isExcluded(name)) {
   if (fast) {
  -scandir(file.getName(),
  +if (file.isSymbolicLink()) {
  +scandir(file.getLink(),
   name + File.separator, fast);
  +} else {
  +scandir(file.getName(),
  +name + File.separator, fast);
  +}
   }
   dirsIncluded.addElement(name);
   } else {
  @@ -284,12 +292,12 @@
   name + File.separator, fast);
   }
   }
  -if (!fast) {
  +if (!fast  slowScanAllowed) {
   scandir(file.getName(),
   name + File.separator, fast);
   }
   } else {
  -if (file.isFile()) {
  +if (isFunctioningAsFile(ftp, dir, file)) {
   String name = vpath + file.getName();
   
   if (isIncluded(name)) {
  @@ -312,8 +320,74 @@
   }
   }
   }
  -
  -
  +/**
  + * check FTPFiles to check whether they function as directories too
  + * the FTPFile 

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-08-05 Thread antoine
antoine 2003/08/05 15:59:16

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  removed output on System.out, sorry
  
  Revision  ChangesPath
  1.42  +0 -2  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- FTP.java  5 Aug 2003 22:23:57 -   1.41
  +++ FTP.java  5 Aug 2003 22:59:16 -   1.42
  @@ -379,8 +379,6 @@
* @since ant 1.6
*/
   private boolean isFunctioningAsFile(FTPClient ftp, String dir, FTPFile 
file) {
  -String testDirectory =  dir + remoteFileSep + file.getName();
  -System.out.println(checking dir entry  + testDirectory);
   if (file.isDirectory()) {
   return false;
   } else if (file.isFile()) {
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-07-29 Thread antoine
antoine 2003/07/29 04:19:28

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  Some ftp servers have binary as default, so when binary is false
  it is good to set explicitly the ascii mode for the transfer.
  Problem reported by Michael Nebus (Michael dot Nebus at Pfizer dot com)
  
  Revision  ChangesPath
  1.39  +6 -0  
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- FTP.java  26 Jul 2003 15:58:11 -  1.38
  +++ FTP.java  29 Jul 2003 11:19:27 -  1.39
  @@ -1203,6 +1203,12 @@
   throw new BuildException(could not set transfer type: 
   + ftp.getReplyString());
   }
  +} else {
  +
ftp.setFileType(org.apache.commons.net.ftp.FTP.ASCII_FILE_TYPE);
  +if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
  +throw new BuildException(could not set transfer type: 
  ++ ftp.getReplyString());
  +}
   }
   
   if (passive) {
  
  
  

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



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-07-22 Thread antoine
antoine 2003/07/22 10:59:52

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  style
  
  Revision  ChangesPath
  1.37  +86 -11
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- FTP.java  6 Jul 2003 09:03:18 -   1.36
  +++ FTP.java  22 Jul 2003 17:59:52 -  1.37
  @@ -83,7 +83,7 @@
* ul
*   li strongsend/strong - send files to a remote server. This is the
*   default action./li
  - *   li strongget/strong - retrive files from a remote server./li
  + *   li strongget/strong - retrieve files from a remote server./li
*   li strongdel/strong - delete files from a remote server./li
*   li stronglist/strong - create a file listing./li
*   li strongchmod/strong - change unix file permissions./li
  @@ -114,7 +114,8 @@
   protected static final int MK_DIR = 4;
   protected static final int CHMOD = 5;
   protected static final int RM_DIR = 6;
  -
  +/** return code of ftp - not implemented in commons-net version 1.0 */
  +private static final int CODE_521 = 521;
   /** Default port for FTP */
   public static final int DEFAULT_FTP_PORT = 21;
   
  @@ -172,16 +173,29 @@
   };
   
   
  +/**
  + * internal class allowing to read the contents of a remote file system
  + * using the FTP protocol
  + * used in particular for ftp get operations
  + */
   protected class FTPDirectoryScanner extends DirectoryScanner {
   protected FTPClient ftp = null;
   
   
  +/**
  + * constructor
  + * @param ftp  ftpclient object
  + */
   public FTPDirectoryScanner(FTPClient ftp) {
   super();
   this.ftp = ftp;
   }
   
   
  +/**
  + * scans the remote directory,
  + * storing internally the included files, directories, ...
  + */
   public void scan() {
   if (includes == null) {
   // No includes supplied, so set it to 'matches all'
  @@ -210,6 +224,13 @@
   }
   
   
  +/**
  + * scans a particular directory
  + * @param dir directory to scan
  + * @param vpath  relative path to the base directory of the remote 
fileset
  + * always ended with a File.separator
  + * @param fast seems to be always true in practice
  + */
   protected void scandir(String dir, String vpath, boolean fast) {
   try {
   if (!ftp.changeWorkingDirectory(dir)) {
  @@ -701,6 +722,8 @@
* @param ftp the FTP client instance to use to execute FTP actions on
*the remote server.
* @param filename the name of the file whose parents should be created.
  + * @throws IOException under non documented circumstances
  + * @throws BuildException if it is impossible to cd to a remote directory
*
*/
   protected void createParents(FTPClient ftp, String filename)
  @@ -761,7 +784,14 @@
   
   /**
* Checks to see if the remote file is current as compared with the local
  - * file. Returns true if the remote file is up to date.
  + * file. Returns true if the target file is up to date.
  + * @param ftp ftpclient
  + * @param localFile local file
  + * @param remoteFile remote file
  + * @return true if the target file is up to date
  + * @throws IOException  in unknown circumstances
  + * @throws BuildException if the date of the remote files cannot be 
found and the action is
  + * GET_FILES
*/
   protected boolean isUpToDate(FTPClient ftp, File localFile,
String remoteFile)
  @@ -797,17 +827,23 @@
   }
   
   
  -/** Sends a site command to the ftp server  */
  +/**
  +* Sends a site command to the ftp server
  +* @param ftp ftp client
  +* @param theCMD command to execute
  +* @throws IOException  in unknown circumstances
  +* @throws BuildException in unknown circumstances
  +*/
   protected void doSiteCommand(FTPClient ftp, String theCMD)
throws IOException, BuildException {
   boolean rc;
  -String myReply[] = null;
  +String[] myReply = null;
   
   log(Doing Site Command:  + theCMD, Project.MSG_VERBOSE);
   
   rc = ftp.sendSiteCommand(theCMD);
   
  -if (rc == false) {
  +if (!rc) {
   log(Failed to issue Site Command:  + theCMD, Project.MSG_WARN);
   } else {
   
  @@ -830,6 +866,13 @@
* spec - no attempt is made to change directories. It is anticipated 
that
* this may eventually cause problems with 

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java

2003-07-06 Thread conor
conor   2003/07/06 02:03:18

  Modified:.docs.xml
   src/main/org/apache/tools/ant ExitException.java
MagicNames.java
   src/main/org/apache/tools/ant/filters TokenFilter.java
   src/main/org/apache/tools/ant/taskdefs Classloader.java
GZip.java LogStreamHandler.java Redirector.java
Rename.java Taskdef.java XSLTLiaison.java
   src/main/org/apache/tools/ant/taskdefs/condition
FilesMatch.java Not.java
   src/main/org/apache/tools/ant/taskdefs/cvslib
RedirectingOutputStream.java
RedirectingStreamHandler.java
   src/main/org/apache/tools/ant/taskdefs/optional/ccm
CCMCheckin.java
   src/main/org/apache/tools/ant/taskdefs/optional/ejb
JonasDeploymentTool.java
   src/main/org/apache/tools/ant/taskdefs/optional/j2ee
JonasHotDeploymentTool.java
   src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  Fix a few checkstyle errors
  
  Revision  ChangesPath
  1.5   +6 -6  ant/docs.xml
  
  Index: docs.xml
  ===
  RCS file: /home/cvs/ant/docs.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -w -u -r1.4 -r1.5
  
  
  
  1.8   +1 -1  ant/src/main/org/apache/tools/ant/ExitException.java
  
  Index: ExitException.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/ExitException.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -w -u -r1.7 -r1.8
  
  
  
  1.2   +6 -2  ant/src/main/org/apache/tools/ant/MagicNames.java
  
  Index: MagicNames.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/MagicNames.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -u -r1.1 -r1.2
  --- MagicNames.java   9 Jun 2003 13:38:06 -   1.1
  +++ MagicNames.java   6 Jul 2003 09:03:17 -   1.2
  @@ -64,5 +64,9 @@
   public class MagicNames {
   /** The name of the script repository used by the script repo task */
   public static final String SCRIPT_REPOSITORY = 
org.apache.ant.scriptrepo;
  +
  +/** The name of the reference to the System Class Loader */
  +public static final String SYSTEM_LOADER_REF = ant.coreLoader;
  +
   }
   
  
  
  
  1.9   +1 -1  
ant/src/main/org/apache/tools/ant/filters/TokenFilter.java
  
  Index: TokenFilter.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/filters/TokenFilter.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -w -u -r1.8 -r1.9
  --- TokenFilter.java  4 Jul 2003 16:16:50 -   1.8
  +++ TokenFilter.java  6 Jul 2003 09:03:17 -   1.9
  @@ -594,7 +594,7 @@
* Abstract class that converts derived filter classes into
* ChainableReaderFilter's
*/
  -public static abstract class ChainableReaderFilter extends 
ProjectComponent
  +public abstract static class ChainableReaderFilter extends 
ProjectComponent
   implements ChainableReader, Filter {
   private boolean byLine = true;
   
  
  
  
  1.7   +70 -62
ant/src/main/org/apache/tools/ant/taskdefs/Classloader.java
  
  Index: Classloader.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Classloader.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -u -r1.6 -r1.7
  --- Classloader.java  22 Apr 2003 07:35:15 -  1.6
  +++ Classloader.java  6 Jul 2003 09:03:17 -   1.7
  @@ -54,11 +54,15 @@
   
   package org.apache.tools.ant.taskdefs;
   
  -import org.apache.tools.ant.*;
  -import org.apache.tools.ant.types.*;
  +import org.apache.tools.ant.Project;
  +import org.apache.tools.ant.Task;
  +import org.apache.tools.ant.MagicNames;
  +import org.apache.tools.ant.BuildException;
  +import org.apache.tools.ant.AntClassLoader;
  +import org.apache.tools.ant.types.Reference;
  +import org.apache.tools.ant.types.Path;
   
  -import java.io.*;
  -import java.util.*;
  +import java.io.File;
   
   /**
* EXPERIMENTAL
  @@ -93,7 +97,8 @@
* @author Costin Manolache
*/
   public class Classloader extends Task {
  -public static final String SYSTEM_LOADER_REF=ant.coreLoader;
  +/** @see MagicNames#SYSTEM_LOADER_REF */
  +public static final String SYSTEM_LOADER_REF = 
MagicNames.SYSTEM_LOADER_REF;
   
   private String name=null;
   private Path classpath;
  @@ -101,23 +106,27 @@
   private boolean parentFirst=true;
   private String parentName=null;