aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggrzy...@apache.org
Subject svn commit: r1784702 - /aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
Date Tue, 28 Feb 2017 08:48:58 GMT
Author: ggrzybek
Date: Tue Feb 28 08:48:57 2017
New Revision: 1784702

URL: http://svn.apache.org/viewvc?rev=1784702&view=rev
Log:
[ARIES-1682] Fallback to URL API if URI.resolve(systemId) is still relative (case of jar:file:)

Modified:
    aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java

Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java?rev=1784702&r1=1784701&r2=1784702&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
(original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
Tue Feb 28 08:48:57 2017
@@ -28,6 +28,7 @@ import java.io.InputStream;
 import java.io.Reader;
 import java.lang.ref.Reference;
 import java.lang.ref.SoftReference;
+import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -576,7 +577,17 @@ public class NamespaceHandlerRegistryImp
                 if (baseURI != null && systemId != null) {
                     URI sId = URI.create(systemId);
                     if (!sId.isAbsolute()) {
-                        return URI.create(baseURI).resolve(sId).toString();
+                        URI resolved = URI.create(baseURI).resolve(sId);
+                        if (resolved.isAbsolute()) {
+                            return resolved.toString();
+                        } else {
+                            try {
+                                return new URL(new URL(baseURI), systemId).toString();
+                            } catch (MalformedURLException e) {
+                                LOGGER.warn("Can't resolve " + systemId + " against " + baseURI);
+                                return null;
+                            }
+                        }
                     }
                 }
                 return null;



Mime
View raw message