mbenson     2005/01/26 14:07:57

  Modified:    src/main/org/apache/tools/ant/util Tag: ANT_16_BRANCH
                        ConcatFileInputStream.java
               .        Tag: ANT_16_BRANCH WHATSNEW
  Log:
  Merge ConcatFIS fix from HEAD.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.2   +12 -14    
ant/src/main/org/apache/tools/ant/util/ConcatFileInputStream.java
  
  Index: ConcatFileInputStream.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/util/ConcatFileInputStream.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ConcatFileInputStream.java        23 Jun 2004 19:30:14 -0000      1.1.2.1
  +++ ConcatFileInputStream.java        26 Jan 2005 22:07:52 -0000      1.1.2.2
  @@ -1,5 +1,5 @@
   /*
  - * Copyright 2004 The Apache Software Foundation
  + * Copyright 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.
  @@ -33,7 +33,7 @@
   public class ConcatFileInputStream extends InputStream {
   
       private static final int EOF = -1;
  -    private int currentIndex = 0;
  +    private int currentIndex = -1;
       private boolean eof = false;
       private File[] file;
       private InputStream currentStream;
  @@ -43,11 +43,10 @@
      * Construct a new <CODE>ConcatFileInputStream</CODE>
      * with the specified <CODE>File[]</CODE>.
      * @param file   <CODE>File[]</CODE>.
  -   * @throws <CODE>IOException</CODE> if I/O errors occur.
  +   * @throws IOException if I/O errors occur.
      */
       public ConcatFileInputStream(File[] file) throws IOException {
           this.file = file;
  -        openFile(currentIndex);
       }
   
       // inherit doc
  @@ -100,21 +99,20 @@
           closeCurrent();
           if (file != null && index < file.length) {
               log("Opening " + file[index], Project.MSG_VERBOSE);
  -            currentStream = new BufferedInputStream(
  -                new FileInputStream(file[index]));
  +            try {
  +                currentStream = new BufferedInputStream(
  +                    new FileInputStream(file[index]));
  +            } catch (IOException eyeOhEx) {
  +                log("Failed to open " + file[index], Project.MSG_ERR);
  +                throw eyeOhEx;
  +            }
           } else {
               eof = true;
           }
       }
   
       private void closeCurrent() {
  -        if (currentStream != null) {
  -            try {
  -                currentStream.close();
  -            } catch (IOException eyeOhEx) {
  -            }
  -            currentStream = null;
  -        }
  +        FileUtils.close(currentStream);
  +        currentStream = null;
       }
   }
  -
  
  
  
  No                   revision
  No                   revision
  1.503.2.165 +4 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.164
  retrieving revision 1.503.2.165
  diff -u -r1.503.2.164 -r1.503.2.165
  --- WHATSNEW  26 Jan 2005 21:46:28 -0000      1.503.2.164
  +++ WHATSNEW  26 Jan 2005 22:07:53 -0000      1.503.2.165
  @@ -154,6 +154,10 @@
     passed in with the current basedir leading twice:
     e.g. ${basedir}${file.separator}${basedir}${file.separator}foo .
   
  +* The first file open that took place when using input files with the
  +  <exec>, <apply>, or <java> tasks was always logged to System.out
  +  instead of to the managing Task.
  +
   Changes from Ant 1.6.1 to Ant 1.6.2
   ===================================
   
  
  
  

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

Reply via email to