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/testcases/org/apache/tools/ant/taskdefs JarTest.java
Date Thu, 20 Feb 2003 17:21:43 GMT
bodewig     2003/02/20 09:21:43

  Modified:    src/testcases/org/apache/tools/ant/taskdefs Tag:
                        ANT_15_BRANCH JarTest.java
  Log:
  close streams properly.
  
  Submitted by:	Antoine Levy-Lambert <levylambert at tiscali dash dsl dot de>
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.8.2.4   +24 -8     ant/src/testcases/org/apache/tools/ant/taskdefs/JarTest.java
  
  Index: JarTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/JarTest.java,v
  retrieving revision 1.8.2.3
  retrieving revision 1.8.2.4
  diff -u -r1.8.2.3 -r1.8.2.4
  --- JarTest.java	19 Feb 2003 08:14:00 -0000	1.8.2.3
  +++ JarTest.java	20 Feb 2003 17:21:43 -0000	1.8.2.4
  @@ -54,9 +54,10 @@
   
   package org.apache.tools.ant.taskdefs;
   
  -import java.io.IOException;
   import java.io.File;
   import java.io.FileReader;
  +import java.io.IOException;
  +import java.io.Reader;
   import java.util.Date;
   import org.apache.tools.ant.BuildFileTest;
   
  @@ -66,6 +67,7 @@
   public class JarTest extends BuildFileTest {
   
       private static String tempJar = "tmp.jar";
  +    private Reader r1, r2;
   
       public JarTest(String name) {
           super(name);
  @@ -76,9 +78,22 @@
       }
   
       public void tearDown() {
  +        if (r1 != null) {
  +            try {
  +                r1.close();
  +            } catch (IOException e) {
  +            }
  +        }
  +        if (r2 != null) {
  +            try {
  +                r2.close();
  +            } catch (IOException e) {
  +            }
  +        }
  +        
           executeTarget("cleanup");
       }
  -    
  +
       public void test1() {
           expectBuildException("test1", "required argument not specified");
       }
  @@ -153,12 +168,13 @@
       public void testManifestStaysIntact() 
           throws IOException, ManifestException {
           executeTarget("testManifestStaysIntact");
  -        Manifest mf1 = 
  -            new Manifest(new FileReader(getProject()
  -                                        .resolveFile("jartmp/manifest")));
  -        Manifest mf2 = 
  -            new Manifest(new FileReader(getProject()
  -                                        .resolveFile("jartmp/META-INF/MANIFEST.MF")));
  +
  +        r1 = new FileReader(getProject()
  +                            .resolveFile("jartmp/manifest"));
  +        r2 = new FileReader(getProject()
  +                            .resolveFile("jartmp/META-INF/MANIFEST.MF"));
  +        Manifest mf1 = new Manifest(r1);
  +        Manifest mf2 = new Manifest(r2);
           assertEquals(mf1, mf2);
       }
   
  
  
  

Mime
View raw message