ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From umag...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Checksum.java
Date Tue, 20 Nov 2001 03:02:18 GMT
umagesh     01/11/19 19:02:18

  Modified:    src/main/org/apache/tools/ant/taskdefs Checksum.java
  Log:
  1. Ensure javac does not report deprecation warnings.
  2. Close fileoutputstream for every iteration.
  
  Revision  Changes    Path
  1.2       +10 -8     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Checksum.java
  
  Index: Checksum.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Checksum.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Checksum.java	2001/11/16 12:30:58	1.1
  +++ Checksum.java	2001/11/20 03:02:18	1.2
  @@ -53,10 +53,11 @@
    */
   package org.apache.tools.ant.taskdefs;
   
  -import java.io.DataInputStream;
  +import java.io.BufferedReader;
   import java.io.File;
   import java.io.FileInputStream;
   import java.io.FileOutputStream;
  +import java.io.InputStreamReader;
   import java.io.IOException;
   import java.security.DigestInputStream;
   import java.security.MessageDigest;
  @@ -377,15 +378,14 @@
                           if (existingFile.exists() &&
                               existingFile.length() == checksum.length()) {
                               fis = new FileInputStream(existingFile);
  -                            DataInputStream edis = new DataInputStream(fis);
  -                            String suppliedChecksum = "";
  -                            if (edis.available() > 0) {
  -                                suppliedChecksum = edis.readLine();
  -                            }
  +                            InputStreamReader isr = new InputStreamReader(fis);
  +                            BufferedReader br = new BufferedReader(isr);
  +                            String suppliedChecksum = br.readLine();
                               fis.close();
                               fis = null;
  -                            edis.close();
  -                            checksumMatches = 
  +                            br.close();
  +                            isr.close();
  +                            checksumMatches =
                                   checksum.equals(suppliedChecksum);
                           } else {
                               checksumMatches = false;
  @@ -394,6 +394,8 @@
                           File dest = (File) destination;
                           fos = new FileOutputStream(dest);
                           fos.write(checksum.getBytes());
  +                        fos.close();
  +                        fos = null;
                       }
                   }
               }
  
  
  

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


Mime
View raw message