You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by mu...@apache.org on 2007/09/10 19:27:23 UTC

svn commit: r574305 - /xml/security/trunk/src/org/apache/xml/security/utils/resolver/implementations/ResolverLocalFilesystem.java

Author: mullan
Date: Mon Sep 10 10:27:22 2007
New Revision: 574305

URL: http://svn.apache.org/viewvc?rev=574305&view=rev
Log:
Fixed bug 42865: Problem with empty BaseURI in ResolverLocalFilesystem

Modified:
    xml/security/trunk/src/org/apache/xml/security/utils/resolver/implementations/ResolverLocalFilesystem.java

Modified: xml/security/trunk/src/org/apache/xml/security/utils/resolver/implementations/ResolverLocalFilesystem.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/utils/resolver/implementations/ResolverLocalFilesystem.java?rev=574305&r1=574304&r2=574305&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/utils/resolver/implementations/ResolverLocalFilesystem.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/utils/resolver/implementations/ResolverLocalFilesystem.java Mon Sep 10 10:27:22 2007
@@ -16,8 +16,6 @@
  */
 package org.apache.xml.security.utils.resolver.implementations;
 
-
-
 import java.io.FileInputStream;
 
 import org.apache.xml.utils.URI;
@@ -26,7 +24,6 @@
 import org.apache.xml.security.utils.resolver.ResourceResolverSpi;
 import org.w3c.dom.Attr;
 
-
 /**
  * A simple ResourceResolver for requests into the local filesystem.
  *
@@ -49,7 +46,7 @@
            throws ResourceResolverException {
 
      try {
-        URI uriNew = new URI(new URI(BaseURI), uri.getNodeValue());
+        URI uriNew = getNewURI(uri.getNodeValue(), BaseURI);
 
         // if the URI contains a fragment, ignore it
         URI uriNewNoFrag = new URI(uriNew);
@@ -142,5 +139,14 @@
       log.debug("But I can't");
 
       return false;
+   }
+
+   private static URI getNewURI(String uri, String BaseURI)
+           throws URI.MalformedURIException {
+
+      if ((BaseURI == null) || "".equals(BaseURI)) {
+         return new URI(uri);
+      }
+      return new URI(new URI(BaseURI), uri);
    }
 }