Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2011-04-29 23:27:57 -0400
committerIgor Fedorenko2011-04-29 23:27:57 -0400
commit564c8ccc38e831299e8c0dff5bf179a98e03ae50 (patch)
treef4a27bef4682d681eeae535f23395885b4b3fdac /org.eclipse.m2e.discovery/src
parent56ea8242e23ce1f6d10e2257f397f64a5c90a251 (diff)
downloadm2e-core-564c8ccc38e831299e8c0dff5bf179a98e03ae50.tar.gz
m2e-core-564c8ccc38e831299e8c0dff5bf179a98e03ae50.tar.xz
m2e-core-564c8ccc38e831299e8c0dff5bf179a98e03ae50.zip
4386865 classcast exception running MavenDiscoveryTest
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
Diffstat (limited to 'org.eclipse.m2e.discovery/src')
-rw-r--r--org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/MavenDiscovery.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/MavenDiscovery.java b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/MavenDiscovery.java
index df5f565e..708731be 100644
--- a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/MavenDiscovery.java
+++ b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/MavenDiscovery.java
@@ -16,6 +16,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.JarURLConnection;
import java.net.URL;
+import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -135,8 +136,10 @@ public class MavenDiscovery {
return null;
}
// To ensure we can delete the temporary file we need to prevent caching, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4386865
- JarURLConnection conn = (JarURLConnection) url.openConnection();
- conn.setDefaultUseCaches(false);
+ URLConnection conn = url.openConnection();
+ if (conn instanceof JarURLConnection) {
+ ((JarURLConnection) conn).setDefaultUseCaches(false);
+ }
InputStream is = conn.getInputStream();
try {
return LifecycleMappingFactory.createLifecycleMappingMetadataSource(is);

Back to the top