diff --git a/web/web-itests/pom.xml b/web/web-itests/pom.xml index b7cc39faa8..e6988c6d39 100644 --- a/web/web-itests/pom.xml +++ b/web/web-itests/pom.xml @@ -48,7 +48,7 @@ 1.2.0-SNAPSHOT 1.0.1-SNAPSHOT 1.9.26 - 3.17.0 + 3.22.0 2.1.1 2.5.3 diff --git a/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WAR_URLServiceHandler.java b/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WAR_URLServiceHandler.java index 05047da239..52c4e076cb 100644 --- a/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WAR_URLServiceHandler.java +++ b/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WAR_URLServiceHandler.java @@ -18,9 +18,12 @@ */ package org.apache.aries.web.url; +import java.io.File; import java.io.IOException; import java.net.URL; import java.net.URLConnection; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; import java.util.Dictionary; import java.util.Hashtable; import java.util.StringTokenizer; @@ -69,8 +72,14 @@ public URLConnection openConnection(URL url) throws IOException firstProperty = false; } } - - return new WARConnection(new URL(url.getPath()), properties); + WARConnection warConnection = new WARConnection(new URL(url.getPath()), properties); + // in new version of org.eclipse.osgi > 3.17.0 we cannot return war connection + // since when its protocol is file then generated input stream is ignored + // and framework reads file again + // https://github.com/eclipse-equinox/equinox/blob/e35221a86afd24ee21b7b9d02db298a90ace1bc0/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java#L1158-L1181 + File webbundle = File.createTempFile("webbundle", ".wab"); + Files.copy(warConnection.getInputStream(), webbundle.toPath(), StandardCopyOption.REPLACE_EXISTING); + return webbundle.getAbsoluteFile().toURI().toURL().openConnection(); } @Override