diff options
author | chibash <chiba@javassist.org> | 2019-09-02 01:08:17 +0900 |
---|---|---|
committer | chibash <chiba@javassist.org> | 2019-09-02 01:08:17 +0900 |
commit | f7ef31ce8b723e425a66aafb8c0beddeabfe9a66 (patch) | |
tree | 4c66b7f3bc0418b5d890380a847c50b85cd70b71 | |
parent | 2e67ed31f8bf788fcc352df6d0780e907676ed14 (diff) | |
download | javassist-f7ef31ce8b723e425a66aafb8c0beddeabfe9a66.tar.gz javassist-f7ef31ce8b723e425a66aafb8c0beddeabfe9a66.zip |
fixes Issue #271
-rw-r--r-- | Readme.html | 2 | ||||
-rw-r--r-- | src/main/javassist/ClassPool.java | 8 | ||||
-rw-r--r-- | src/main/javassist/ClassPoolTail.java | 10 |
3 files changed, 16 insertions, 4 deletions
diff --git a/Readme.html b/Readme.html index ae68ac6c..461c614a 100644 --- a/Readme.html +++ b/Readme.html @@ -283,7 +283,7 @@ see javassist.Dump. <p>-version 3.26 <ul> - <li>GitHub Issue #270 (PR #272), Issue #265 (PR #267). + <li>GitHub Issue #270 (PR #272), Issue #265 (PR #267), Issue #271 and #222. </ul> <p>-version 3.25 on April 16, 2019 diff --git a/src/main/javassist/ClassPool.java b/src/main/javassist/ClassPool.java index 7d8cde08..326c643b 100644 --- a/src/main/javassist/ClassPool.java +++ b/src/main/javassist/ClassPool.java @@ -113,6 +113,14 @@ public class ClassPool { */ public static boolean releaseUnmodifiedClassFile = true; + /** + * If true, the contents of a jar file are cached after the jar + * file is opened. + * + * <p>The initial value is true. + */ + public static boolean cacheOpenedJarFile = true; // see ClassPoolTail.JarClassPath#openClassfile(String) + protected ClassPoolTail source; protected ClassPool parent; protected Hashtable classes; // should be synchronous diff --git a/src/main/javassist/ClassPoolTail.java b/src/main/javassist/ClassPoolTail.java index 965d72fb..d9d2198e 100644 --- a/src/main/javassist/ClassPoolTail.java +++ b/src/main/javassist/ClassPoolTail.java @@ -159,9 +159,13 @@ final class JarClassPath implements ClassPath { URL jarURL = find(classname); if (null != jarURL) try { - java.net.URLConnection con = jarURL.openConnection(); - con.setUseCaches(false); - return con.getInputStream(); + if (ClassPool.cacheOpenedJarFile) + return jarURL.openConnection().getInputStream(); + else { + java.net.URLConnection con = jarURL.openConnection(); + con.setUseCaches(false); + return con.getInputStream(); + } } catch (IOException e) { throw new NotFoundException("broken jar file?: " |