Browse Source

reduce performance loss in AntClassLoader from 1000% to about 50%. PR 48853

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@918989 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 15 years ago
parent
commit
3e2cbab6ba
2 changed files with 8 additions and 2 deletions
  1. +4
    -0
      WHATSNEW
  2. +4
    -2
      src/main/org/apache/tools/ant/AntClassLoader.java

+ 4
- 0
WHATSNEW View File

@@ -51,6 +51,10 @@ Fixed bugs:
* Broken Pipe issue under Ubuntu Linux * Broken Pipe issue under Ubuntu Linux
Bugzilla Report 48789 Bugzilla Report 48789


* AntClassLoader in Ant 1.8.0 has been considerably slower than in
1.7.1
Bugzilla Report 48853

Other changes: Other changes:
-------------- --------------




+ 4
- 2
src/main/org/apache/tools/ant/AntClassLoader.java View File

@@ -17,6 +17,7 @@
*/ */
package org.apache.tools.ant; package org.apache.tools.ant;


import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@@ -1213,8 +1214,9 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
JarEntry ent = jarFile.getJarEntry(entry); JarEntry ent = jarFile.getJarEntry(entry);
if (ent != null) { if (ent != null) {
// must read the input in order to obtain certificates // must read the input in order to obtain certificates
is = jarFile.getInputStream(ent);
while (is.read() >= 0);
is = new BufferedInputStream(jarFile.getInputStream(ent));
byte[] b = new byte[BUFFER_SIZE];
while (is.read(b, 0, BUFFER_SIZE) >= 0);
} }
return ent == null ? null : ent.getCertificates(); return ent == null ? null : ent.getCertificates();
} finally { } finally {


Loading…
Cancel
Save