You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by bo...@apache.org on 2007/04/18 17:29:18 UTC
svn commit: r530061 -
/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java
Author: boisvert
Date: Wed Apr 18 08:29:17 2007
New Revision: 530061
URL: http://svn.apache.org/viewvc?view=rev&rev=530061
Log:
Fix ODE-111: Support <xsd:include> with relative schemaLocation
Modified:
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java
Modified: incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java?view=diff&rev=530061&r1=530060&r2=530061
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java (original)
+++ incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/DefaultResourceFinder.java Wed Apr 18 08:29:17 2007
@@ -31,13 +31,13 @@
/**
* Basic implementation of the {@link ResourceFinder} interface. Resolves
* URIs relative to a base URI specified at the time of construction.
- *
+ *
* @author Maciej Szefler - m s z e f l e r @ g m a i l . c o m
*
*/
public class DefaultResourceFinder implements ResourceFinder {
- private static final Log __log = LogFactory.getLog(DefaultResourceFinder.class);
-
+ private static final Log __log = LogFactory.getLog(DefaultResourceFinder.class);
+
private File _suDir;
/**
@@ -58,21 +58,30 @@
public InputStream openResource(URI uri) throws MalformedURLException, IOException {
URI suURI = _suDir.toURI();
-
- // Note that if we get an absolute URI, the relativize operation will simply
- // return the absolute URI.
+
+ if (uri.isAbsolute() && uri.getScheme().equals("file")) {
+ try {
+ return uri.toURL().openStream();
+ } catch (Exception except) {
+ __log.fatal("openResource: unable to open file URL " + uri + "; " + except.toString());
+ return null;
+ }
+ }
+
+ // Note that if we get an absolute URI, the relativize operation will simply
+ // return the absolute URI.
URI relative = suURI.relativize(uri);
if (relative.isAbsolute() && !relative.getScheme().equals("urn")) {
__log.fatal("openResource: invalid scheme (should be urn:) " + uri);
return null;
}
-
+
File f = new File(suURI.getPath(),relative.getPath());
if (!f.exists()) {
__log.debug("fileNotFound: " + f);
return null;
}
-
+
return new FileInputStream(f);
}