caching. PR 54473. Combining patches by René Krell and Antoine Levy-Lambert. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1554684 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -299,6 +299,7 @@ Randy Watler | |||||
| Raphael Pierquin | Raphael Pierquin | ||||
| Ray Waldin | Ray Waldin | ||||
| Remie Bolte | Remie Bolte | ||||
| René Krell | |||||
| Richard Evans | Richard Evans | ||||
| Richard Steele | Richard Steele | ||||
| Rick Beton | Rick Beton | ||||
| @@ -36,6 +36,10 @@ Fixed bugs: | |||||
| readers. | readers. | ||||
| Bugzilla Report 54672 | Bugzilla Report 54672 | ||||
| * several places where resources are read from jars will now | |||||
| explicitly disable caching to avoid problems with reloading jars. | |||||
| Bugzilla Report 54473 | |||||
| Other changes: | Other changes: | ||||
| -------------- | -------------- | ||||
| @@ -1209,6 +1209,10 @@ | |||||
| <first>Remie</first> | <first>Remie</first> | ||||
| <last>Bolte</last> | <last>Bolte</last> | ||||
| </name> | </name> | ||||
| <name> | |||||
| <first>René</first> | |||||
| <last>Krell</last> | |||||
| </name> | |||||
| <name> | <name> | ||||
| <first>Richard</first> | <first>Richard</first> | ||||
| <last>Evans</last> | <last>Evans</last> | ||||
| @@ -22,6 +22,7 @@ import java.io.IOException; | |||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.io.InputStreamReader; | import java.io.InputStreamReader; | ||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLConnection; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -74,7 +75,9 @@ public class ArgumentProcessorRegistry { | |||||
| Enumeration<URL> resources = classLoader.getResources(SERVICE_ID); | Enumeration<URL> resources = classLoader.getResources(SERVICE_ID); | ||||
| while (resources.hasMoreElements()) { | while (resources.hasMoreElements()) { | ||||
| URL resource = resources.nextElement(); | URL resource = resources.nextElement(); | ||||
| ArgumentProcessor processor = getProcessorByService(resource.openStream()); | |||||
| URLConnection conn = resource.openConnection(); | |||||
| conn.setDefaultUseCaches(false); | |||||
| ArgumentProcessor processor = getProcessorByService(conn.getInputStream()); | |||||
| registerArgumentProcessor(processor); | registerArgumentProcessor(processor); | ||||
| } | } | ||||
| } | } | ||||
| @@ -22,6 +22,7 @@ import java.io.InputStream; | |||||
| import java.io.InputStreamReader; | import java.io.InputStreamReader; | ||||
| import java.lang.reflect.Constructor; | import java.lang.reflect.Constructor; | ||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLConnection; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| @@ -87,8 +88,10 @@ public class ProjectHelperRepository { | |||||
| classLoader.getResources(ProjectHelper.SERVICE_ID); | classLoader.getResources(ProjectHelper.SERVICE_ID); | ||||
| while (resources.hasMoreElements()) { | while (resources.hasMoreElements()) { | ||||
| URL resource = resources.nextElement(); | URL resource = resources.nextElement(); | ||||
| URLConnection conn = resource.openConnection(); | |||||
| conn.setDefaultUseCaches(false); | |||||
| projectHelper = | projectHelper = | ||||
| getProjectHelperByService(resource.openStream()); | |||||
| getProjectHelperByService(conn.getInputStream()); | |||||
| registerProjectHelper(projectHelper); | registerProjectHelper(projectHelper); | ||||
| } | } | ||||
| } | } | ||||
| @@ -48,6 +48,7 @@ import java.io.IOException; | |||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.io.UnsupportedEncodingException; | import java.io.UnsupportedEncodingException; | ||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLConnection; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -257,7 +258,9 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
| inputStream = | inputStream = | ||||
| zf.getInputStream(zf.getEntry(uri.substring(pling + 1))); | zf.getInputStream(zf.getEntry(uri.substring(pling + 1))); | ||||
| } else { | } else { | ||||
| inputStream = url.openStream(); | |||||
| URLConnection conn = url.openConnection(); | |||||
| conn.setDefaultUseCaches(false); | |||||
| inputStream = conn.getInputStream(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLConnection; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -63,7 +64,9 @@ public class Antlib extends Task implements TaskContainer { | |||||
| String uri) { | String uri) { | ||||
| // Check if we can contact the URL | // Check if we can contact the URL | ||||
| try { | try { | ||||
| antlibUrl.openConnection().connect(); | |||||
| URLConnection conn = antlibUrl.openConnection(); | |||||
| conn.setDefaultUseCaches(false); | |||||
| conn.connect(); | |||||
| } catch (IOException ex) { | } catch (IOException ex) { | ||||
| throw new BuildException( | throw new BuildException( | ||||
| "Unable to find " + antlibUrl, ex); | "Unable to find " + antlibUrl, ex); | ||||
| @@ -26,6 +26,7 @@ import java.io.IOException; | |||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.net.MalformedURLException; | import java.net.MalformedURLException; | ||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLConnection; | |||||
| import java.util.Stack; | import java.util.Stack; | ||||
| import java.util.Vector; | import java.util.Vector; | ||||
| import javax.xml.parsers.ParserConfigurationException; | import javax.xml.parsers.ParserConfigurationException; | ||||
| @@ -763,7 +764,12 @@ public class XMLCatalog extends DataType | |||||
| if (url != null) { | if (url != null) { | ||||
| try { | try { | ||||
| InputStream is = url.openStream(); | |||||
| InputStream is = null; | |||||
| URLConnection conn = url.openConnection(); | |||||
| if (conn != null) { | |||||
| conn.setDefaultUseCaches(false); | |||||
| is = conn.getInputStream(); | |||||
| } | |||||
| if (is != null) { | if (is != null) { | ||||
| source = new InputSource(is); | source = new InputSource(is); | ||||
| String sysid = url.toExternalForm(); | String sysid = url.toExternalForm(); | ||||