Browse Source

Reviewed Jar (and parts of Zip) because of BR 42632

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@552218 13f79535-47bb-0310-9956-ffa450edef68
master
Jacobus Martinus Kruithof 18 years ago
parent
commit
7627a966ee
2 changed files with 7 additions and 8 deletions
  1. +3
    -7
      src/main/org/apache/tools/ant/taskdefs/Jar.java
  2. +4
    -1
      src/main/org/apache/tools/ant/taskdefs/Zip.java

+ 3
- 7
src/main/org/apache/tools/ant/taskdefs/Jar.java View File

@@ -150,10 +150,6 @@ public class Jar extends Zip {
JarMarker.getInstance() JarMarker.getInstance()
}; };


// CheckStyle:VisibilityModifier OFF - bc
protected String emptyBehavior = "create";
// CheckStyle:VisibilityModifier ON

/** constructor */ /** constructor */
public Jar() { public Jar() {
super(); super();
@@ -456,7 +452,7 @@ public class Jar extends Zip {
throws IOException { throws IOException {
for (Enumeration e = manifest.getWarnings(); for (Enumeration e = manifest.getWarnings();
e.hasMoreElements();) { e.hasMoreElements();) {
log("Manifest warning: " + (String) e.nextElement(),
log("Manifest warning: " + e.nextElement(),
Project.MSG_WARN); Project.MSG_WARN);
} }


@@ -467,7 +463,7 @@ public class Jar extends Zip {
OutputStreamWriter osw = new OutputStreamWriter(baos, Manifest.JAR_ENCODING); OutputStreamWriter osw = new OutputStreamWriter(baos, Manifest.JAR_ENCODING);
PrintWriter writer = new PrintWriter(osw); PrintWriter writer = new PrintWriter(osw);
manifest.write(writer); manifest.write(writer);
writer.flush();
writer.close();


ByteArrayInputStream bais = ByteArrayInputStream bais =
new ByteArrayInputStream(baos.toByteArray()); new ByteArrayInputStream(baos.toByteArray());
@@ -549,7 +545,7 @@ public class Jar extends Zip {
} }
} }


writer.flush();
writer.close();
ByteArrayInputStream bais = ByteArrayInputStream bais =
new ByteArrayInputStream(baos.toByteArray()); new ByteArrayInputStream(baos.toByteArray());
super.zipFile(bais, zOut, INDEX_NAME, System.currentTimeMillis(), null, super.zipFile(bais, zOut, INDEX_NAME, System.currentTimeMillis(), null,


+ 4
- 1
src/main/org/apache/tools/ant/taskdefs/Zip.java View File

@@ -759,13 +759,16 @@ public class Zip extends MatchingTask {
if (keepCompression) { if (keepCompression) {
doCompress = (ze.getMethod() == ZipEntry.DEFLATED); doCompress = (ze.getMethod() == ZipEntry.DEFLATED);
} }
InputStream is = null;
try { try {
zipFile(zf.getInputStream(ze), zOut, prefix + name,
is = zf.getInputStream(ze);
zipFile(is, zOut, prefix + name,
ze.getTime(), zfs.getSrc(getProject()), ze.getTime(), zfs.getSrc(getProject()),
zfs.hasFileModeBeenSet() ? fileMode zfs.hasFileModeBeenSet() ? fileMode
: ze.getUnixMode()); : ze.getUnixMode());
} finally { } finally {
doCompress = oldCompress; doCompress = oldCompress;
FileUtils.close(is);
} }
} }
} else { } else {


Loading…
Cancel
Save