crossley    02/01/17 19:17:24

  Modified:    src/java/org/apache/cocoon/components/resolver
                        ResolverImpl.java
  Log:
  Ensure that getting the full pathname of a file works properly in both
  webapp and commandline contexts. First try getRealPath(), and only if
  it returns null then use getResource()
  PR:5060
  Submitted by: Berhard Huber
  
  Revision  Changes    Path
  1.3       +7 -3      
xml-cocoon2/src/java/org/apache/cocoon/components/resolver/ResolverImpl.java
  
  Index: ResolverImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/resolver/ResolverImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResolverImpl.java 17 Jan 2002 06:15:24 -0000      1.2
  +++ ResolverImpl.java 18 Jan 2002 03:17:23 -0000      1.3
  @@ -44,7 +44,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Davanum Srinivas</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>David Crossley</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2002/01/17 06:15:24 $
  + * @version CVS $Revision: 1.3 $ $Date: 2002/01/18 03:17:23 $
    */
   public class ResolverImpl extends AbstractLoggable
           implements Resolver, Contextualizable, Composable, Parameterizable,
  @@ -97,8 +97,12 @@
           String catalogFile = params.getParameter("catalog",
                                   "/resources/entities/catalog");
           try {
  -            String catalogURL =
  -                this.context.getResource(catalogFile).toExternalForm();
  +            String catalogURL = null;
  +            catalogURL = this.context.getRealPath(catalogFile);
  +            if (catalogURL == null) {
  +                catalogURL = 
  +                    this.context.getResource(catalogFile).toExternalForm();
  +            }
               if (this.getLogger().isDebugEnabled() == true) {
                   this.getLogger().debug("System OASIS Catalog URL is "
                       + catalogURL);
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to