Skip to content

Commit

Permalink
fixes Issue #271
Browse files Browse the repository at this point in the history
  • Loading branch information
chibash committed Sep 1, 2019
1 parent 2e67ed3 commit f7ef31c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Readme.html
Expand Up @@ -283,7 +283,7 @@ <h2>Changes</h2>

<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
Expand Down
8 changes: 8 additions & 0 deletions src/main/javassist/ClassPool.java
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions src/main/javassist/ClassPoolTail.java
Expand Up @@ -159,9 +159,13 @@ public InputStream openClassfile(String classname)
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?: "
Expand Down

0 comments on commit f7ef31c

Please sign in to comment.