ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Jar.java
Date Sun, 16 Feb 2003 02:35:00 GMT
conor       2003/02/15 18:35:00

  Modified:    src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH
                        Jar.java
  Log:
  Merge
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.51.2.15 +17 -11    ant/src/main/org/apache/tools/ant/taskdefs/Jar.java
  
  Index: Jar.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Jar.java,v
  retrieving revision 1.51.2.14
  retrieving revision 1.51.2.15
  diff -u -w -u -r1.51.2.14 -r1.51.2.15
  --- Jar.java	10 Feb 2003 14:24:44 -0000	1.51.2.14
  +++ Jar.java	16 Feb 2003 02:35:00 -0000	1.51.2.15
  @@ -61,7 +61,6 @@
   import org.apache.tools.ant.types.EnumeratedAttribute;
   import org.apache.tools.zip.ZipOutputStream;
   
  -import java.io.IOException;
   import java.io.File;
   import java.io.InputStream;
   import java.io.Reader;
  @@ -70,6 +69,9 @@
   import java.io.PrintWriter;
   import java.io.ByteArrayInputStream;
   import java.io.OutputStreamWriter;
  +import java.io.FileOutputStream;
  +import java.io.FileInputStream;
  +import java.io.IOException;
   import java.io.InputStreamReader;
   import java.util.Enumeration;
   import java.util.zip.ZipEntry;
  @@ -227,7 +229,7 @@
        * or the name of a jar added through a fileset. If its the name of an added
        * jar, the task expects the manifest to be in the jar at META-INF/MANIFEST.MF.
        *
  -     * @param manifestFile
  +     * @param manifestFile the manifest file to use.
        */
       public void setManifest(File manifestFile) {
           if (!manifestFile.exists()) {
  @@ -241,18 +243,20 @@
       private Manifest getManifest(File manifestFile) {
   
           Manifest newManifest = null;
  -        Reader r = null;
  +        FileInputStream fis = null;
  +        InputStreamReader isr = null;
           try {
  -            r = new FileReader(manifestFile);
  -            newManifest = getManifest(r);
  +            fis = new FileInputStream(manifestFile);
  +            isr = new InputStreamReader(fis, "UTF-8");
  +            newManifest = getManifest(isr);
           } catch (IOException e) {
               throw new BuildException("Unable to read manifest file: "
                                        + manifestFile
                                        + " (" + e.getMessage() + ")", e);
           } finally {
  -            if (r != null) {
  +            if (isr != null) {
                   try {
  -                    r.close();
  +                    isr.close();
                   } catch (IOException e) {
                       // do nothing
                   }
  @@ -367,7 +371,8 @@
           zipDir(null, zOut, "META-INF/");
           // time to write the manifest
           ByteArrayOutputStream baos = new ByteArrayOutputStream();
  -        PrintWriter writer = new PrintWriter(baos);
  +        OutputStreamWriter osw = new OutputStreamWriter(baos, "UTF-8");
  +        PrintWriter writer = new PrintWriter(osw);
           manifest.write(writer);
           writer.flush();
   
  @@ -469,13 +474,13 @@
           }
       }
   
  -    private void filesetManifest(File file, InputStream is) {
  +    private void filesetManifest(File file, InputStream is) throws IOException {
           if (manifestFile != null && manifestFile.equals(file)) {
               // If this is the same name specified in 'manifest', this
               // is the manifest to use
               log("Found manifest " + file, Project.MSG_VERBOSE);
               if (is != null) {
  -                manifest = getManifest(new InputStreamReader(is));
  +                manifest = getManifest(new InputStreamReader(is, "UTF-8"));
               } else {
                   manifest = getManifest(file);
               }
  @@ -488,7 +493,8 @@
               try {
                   Manifest newManifest = null;
                   if (is != null) {
  -                    newManifest = getManifest(new InputStreamReader(is));
  +                    newManifest 
  +                        = getManifest(new InputStreamReader(is, "UTF-8"));
                   } else {
                       newManifest = getManifest(file);
                   }
  
  
  

Mime
View raw message