ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh Scp.java
Date Wed, 27 Aug 2003 10:07:12 GMT
bodewig     2003/08/27 03:07:12

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/ssh Scp.java
  Log:
  Don't connect to remote site when you know there is nothing to transfer.
  
  also fixes PR: 22726
  
  Revision  Changes    Path
  1.8       +12 -3     ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java
  
  Index: Scp.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Scp.java	27 Aug 2003 09:34:25 -0000	1.7
  +++ Scp.java	27 Aug 2003 10:07:11 -0000	1.8
  @@ -197,17 +197,22 @@
   
           Session session = null;
           try {
  -            session = openSession();
               List list = new ArrayList(fileSet.size());
               for (Iterator i = fileSet.iterator(); i.hasNext();) {
                   FileSet set = (FileSet) i.next();
  -                list.add(createDirectory(set));
  +                Directory d = createDirectory(set);
  +                if (d != null) {
  +                    list.add(d);
  +                }
               }
  +            if (!list.isEmpty()) {
  +            session = openSession();
               ScpToMessage message = new ScpToMessage(session,
                                                        list,
                                                        file);
               message.setLogListener(this);
               message.execute();
  +            }
           } finally {
               if (session != null) {
                   session.disconnect();
  @@ -275,6 +280,7 @@
           DirectoryScanner scanner = set.getDirectoryScanner(getProject());
           Directory root = new Directory(scanner.getBasedir());
           String[] files = scanner.getIncludedFiles();
  +        if (files.length != 0) {
           for (int j = 0; j < files.length; j++) {
               String[] path = Directory.getPath(files[j]);
               Directory current = root;
  @@ -290,7 +296,10 @@
                   }
               }
           }
  -
  +        } else {
  +            // skip
  +            root = null;
  +        }
           return root;
       }
   }
  
  
  

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


Mime
View raw message