? XMLWorkflowFactory.java.diff
Index: XMLWorkflowFactory.java
===================================================================
RCS file: /cvs/osworkflow/src/java/com/opensymphony/workflow/loader/XMLWorkflowFactory.java,v
retrieving revision 1.20
diff -r1.20 XMLWorkflowFactory.java
92,93d91
<         ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
<         InputStream is = null;
95,129c93
< 
<         if ((name != null) && (name.indexOf(":/") > -1)) {
<             try {
<                 is = new URL(name).openStream();
<             } catch (Exception e) {
<             }
<         }
< 
<         if (is == null) {
<             try {
<                 is = classLoader.getResourceAsStream(name);
<             } catch (Exception e) {
<             }
<         }
< 
<         if (is == null) {
<             try {
<                 is = classLoader.getResourceAsStream("/" + name);
<             } catch (Exception e) {
<             }
<         }
< 
<         if (is == null) {
<             try {
<                 is = classLoader.getResourceAsStream("META-INF/" + name);
<             } catch (Exception e) {
<             }
<         }
< 
<         if (is == null) {
<             try {
<                 is = classLoader.getResourceAsStream("/META-INF/" + name);
<             } catch (Exception e) {
<             }
<         }
---
>         InputStream is = getInputStream(name);
151a116,117
>             String basedir = getBaseDir(root);
> 
156c122
<                 WorkflowConfig config = new WorkflowConfig(e.getAttribute("type"), e.getAttribute("location"));
---
>                 WorkflowConfig config = new WorkflowConfig(basedir, e.getAttribute("type"), e.getAttribute("location"));
228a195,267
>     /**
>      * Get where to find workflow XML files.
>      * @param root The root element of the XML file.
>      * @return The absolute base dir used for finding these files or null.
>      */
>     protected String getBaseDir(Element root) {
>         String basedir = root.getAttribute("basedir");
> 
>         if (basedir.length() == 0) {
>             // No base dir defined
>             return null;
>         }
> 
>         if (new File(basedir).isAbsolute()) {
>             // An absolute base dir defined
>             return basedir;
>         } else {
>             // Append the current working directory to the relative base dir
>             return new File(System.getProperty("user.dir"), basedir).getAbsolutePath();
>         }
>     }
> 
>     /**
>      * Load the workflow config file from the current context classloader.
>      * The search order is:
>      * <li>Specified URL</li>
>      * <li>&lt;name&gt;</li>
>      * <li>/&lt;name&gt;</li>
>      * <li>META-INF/&lt;name&gt;</li>
>      * <li>/META-INF/&lt;name&gt;</li>
>      */
>     protected InputStream getInputStream(String name) {
>         ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
>         InputStream is = null;
> 
>         if ((name != null) && (name.indexOf(":/") > -1)) {
>             try {
>                 is = new URL(name).openStream();
>             } catch (Exception e) {
>             }
>         }
> 
>         if (is == null) {
>             try {
>                 is = classLoader.getResourceAsStream(name);
>             } catch (Exception e) {
>             }
>         }
> 
>         if (is == null) {
>             try {
>                 is = classLoader.getResourceAsStream("/" + name);
>             } catch (Exception e) {
>             }
>         }
> 
>         if (is == null) {
>             try {
>                 is = classLoader.getResourceAsStream("META-INF/" + name);
>             } catch (Exception e) {
>             }
>         }
> 
>         if (is == null) {
>             try {
>                 is = classLoader.getResourceAsStream("/META-INF/" + name);
>             } catch (Exception e) {
>             }
>         }
> 
>         return is;
>     }
> 
255c294
<         public WorkflowConfig(String type, String location) {
---
>         public WorkflowConfig(String basedir, String type, String location) {
269c308
<                     File file = new File(location);
---
>                     File file = new File(basedir, location);
