ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs CVSPassTest.java
Date Tue, 01 May 2001 11:37:56 GMT
nico        01/05/01 04:37:56

  Modified:    src/testcases/org/apache/tools/ant/taskdefs CVSPassTest.java
  Log:
  The file was not correctly closed after validating it's contents, so the tests
  failed on Windows.
  
  Revision  Changes    Path
  1.2       +14 -6     jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/CVSPassTest.java
  
  Index: CVSPassTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/CVSPassTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CVSPassTest.java	2001/04/27 11:52:55	1.1
  +++ CVSPassTest.java	2001/05/01 11:37:56	1.2
  @@ -138,13 +138,21 @@
       }
   
       private String readFile(File f) throws Exception {
  -        BufferedReader reader = new BufferedReader(new FileReader(f));
  +        BufferedReader reader = null; 
  +        
  +        try {
  +            reader = new BufferedReader(new FileReader(f));
   
  -        StringBuffer buf = new StringBuffer();
  -        String line=null;
  -        while((line=reader.readLine())!=null){
  -            buf.append(line + EOL);
  +            StringBuffer buf = new StringBuffer();
  +            String line=null;
  +            while((line=reader.readLine())!=null){
  +                buf.append(line + EOL);
  +            }
  +            return buf.toString();
  +        } finally {
  +            if (reader != null) {
  +                reader.close();
  +            }
           }
  -        return buf.toString();
       }
   }
  
  
  

Mime
View raw message