sylvain     2003/01/08 06:08:05

  Modified:    src/java/org/apache/cocoon/components/source/impl
                        ContextSourceFactory.java
  Log:
  Fix endless loop
  
  Revision  Changes    Path
  1.8       +14 -2     
xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java
  
  Index: ContextSourceFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ContextSourceFactory.java 8 Jan 2003 11:04:53 -0000       1.7
  +++ ContextSourceFactory.java 8 Jan 2003 14:08:05 -0000       1.8
  @@ -99,7 +99,10 @@
        */
       public void compose(ComponentManager manager) throws ComponentException {
           this.manager = manager;
  -        this.resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
  +        // FIXME : Looking up the resolver here leads to an infinite loop
  +        // (is this because of Avalon or CocoonComponentManager ??)
  +        // So we delay this for to the first call to getSource().
  +        //this.resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
       }
   
       /**
  @@ -132,6 +135,15 @@
               this.getLogger().debug( "Creating source object for " + location );
           }
   
  +        // Lookup resolver if needed
  +        if (this.resolver == null) {
  +            try {
  +                this.resolver = (SourceResolver)this.manager.lookup( 
SourceResolver.ROLE );
  +            } catch (ComponentException ce) {
  +             throw new SourceException("Unable to lookup source resolver.", ce);
  +            }
  +        }
  +                
           // Remove the protocol and the first '/'
           int pos = location.indexOf(":/");
           String path = location.substring(pos+1);
  
  
  

----------------------------------------------------------------------
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