You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2007/10/17 22:11:30 UTC

svn commit: r585662 - in /cocoon/trunk/core/cocoon-pipeline: cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/ cocoon-pipeline-impl/src/main/ja...

Author: vgritsenko
Date: Wed Oct 17 13:11:29 2007
New Revision: 585662

URL: http://svn.apache.org/viewvc?rev=585662&view=rev
Log:
switching to new AbstractLogEnabled.
fixing some obvious bugs.

Modified:
    cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java
    cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/EmptySourceFactory.java
    cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSource.java
    cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSourceFactory.java
    cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxErrorListener.java
    cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java
    cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java
    cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/BaseCachingProcessingPipeline.java

Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java?rev=585662&r1=585661&r2=585662&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java Wed Oct 17 13:11:29 2007
@@ -22,18 +22,14 @@
 import java.net.URL;
 import java.util.Map;
 import java.util.Set;
-
 import javax.servlet.ServletContext;
 
 import org.apache.avalon.framework.context.ContextException;
 import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.Constants;
-import org.apache.cocoon.environment.Context;
 import org.apache.commons.lang.BooleanUtils;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceException;
@@ -43,6 +39,10 @@
 import org.apache.excalibur.source.TraversableSource;
 import org.apache.excalibur.source.URIAbsolutizer;
 
+import org.apache.cocoon.Constants;
+import org.apache.cocoon.environment.Context;
+import org.apache.cocoon.util.AbstractLogEnabled;
+
 /**
  * A factory for the context protocol using the context of the servlet api. 
  * It builds the source by asking the environment context for the real URL
@@ -51,13 +51,9 @@
  *
  * @version $Id$
  */
-public class ContextSourceFactory
-extends AbstractLogEnabled
-implements SourceFactory, 
-            Serviceable, 
-            Contextualizable, 
-            ThreadSafe, 
-            URIAbsolutizer {
+public class ContextSourceFactory extends AbstractLogEnabled
+                                  implements SourceFactory, Serviceable, Contextualizable,
+                                             ThreadSafe, URIAbsolutizer {
 
     /** The ServiceManager */
     protected ServiceManager manager;
@@ -83,16 +79,15 @@
     /**
      * @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String, java.util.Map)
      */
-    public Source getSource( String location, Map parameters )
-    throws SourceException, MalformedURLException, IOException {
-        if( this.getLogger().isDebugEnabled() ) {
-            this.getLogger().debug( "Creating source object for " + location );
+    public Source getSource(String location, Map parameters) throws IOException {
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("Creating source object for " + location);
         }
 
         // Lookup resolver 
         SourceResolver resolver = null;
         try {
-            resolver = (SourceResolver)this.manager.lookup( SourceResolver.ROLE );
+            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
 
             // Remove the protocol and the first '/'
             final int pos = location.indexOf(":/");
@@ -144,22 +139,22 @@
         // In fact, this method should never be called as this factory
         // returns a source object from a different factory. So that
         // factory should release the source
-        if ( null != source ) {
-            if ( this.getLogger().isDebugEnabled() ) {
-                this.getLogger().debug("Releasing source " + source.getURI());
+        if (null != source) {
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Releasing source " + source.getURI());
             }
             SourceResolver resolver = null;
             try {
-                resolver = (SourceResolver)this.manager.lookup( SourceResolver.ROLE );
-                if ( source instanceof TraversableContextSource ) {
-                    resolver.release(((TraversableContextSource)source).wrappedSource);
+                resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
+                if (source instanceof TraversableContextSource) {
+                    resolver.release(((TraversableContextSource) source).wrappedSource);
                 } else {
-                    resolver.release( source );
+                    resolver.release(source);
                 }
             } catch (ServiceException ingore) {
                 // we ignore this
             } finally {
-                this.manager.release( resolver );
+                this.manager.release(resolver);
             }
         }
     }

Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/EmptySourceFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/EmptySourceFactory.java?rev=585662&r1=585661&r2=585662&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/EmptySourceFactory.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/EmptySourceFactory.java Wed Oct 17 13:11:29 2007
@@ -17,10 +17,8 @@
 package org.apache.cocoon.components.source.impl;
 
 import java.io.IOException;
-import java.net.MalformedURLException;
 import java.util.Map;
 
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceFactory;
@@ -31,8 +29,7 @@
  * @version $Id$
  * @since 2.1.8
  */
-public class EmptySourceFactory extends AbstractLogEnabled
-                                implements SourceFactory, ThreadSafe {
+public class EmptySourceFactory implements SourceFactory, ThreadSafe {
 
     /**
      * Get an {@link EmptySource} object.
@@ -42,8 +39,7 @@
      *
      * @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String, java.util.Map)
      */
-    public Source getSource(String location, Map parameters)
-    throws IOException, MalformedURLException {
+    public Source getSource(String location, Map parameters) throws IOException {
         return new EmptySource(location);
     }
 

Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSource.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSource.java?rev=585662&r1=585661&r2=585662&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSource.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSource.java Wed Oct 17 13:11:29 2007
@@ -23,12 +23,13 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.cocoon.util.MIMEUtils;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceNotFoundException;
-import org.apache.excalibur.source.SourceValidity;
 import org.apache.excalibur.source.SourceResolver;
+import org.apache.excalibur.source.SourceValidity;
+
+import org.apache.cocoon.util.AbstractLogEnabled;
+import org.apache.cocoon.util.MIMEUtils;
 
 /**
  * @version $Id$
@@ -88,7 +89,7 @@
         }
     }
 
-    public InputStream getInputStream() throws IOException, SourceNotFoundException {
+    public InputStream getInputStream() throws IOException {
         ZipInputStream zipStream = new ZipInputStream(this.archive.getInputStream());
         try {
             ZipEntry entry = findEntry(zipStream);

Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSourceFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSourceFactory.java?rev=585662&r1=585661&r2=585662&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSourceFactory.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSourceFactory.java Wed Oct 17 13:11:29 2007
@@ -20,7 +20,6 @@
 import java.net.MalformedURLException;
 import java.util.Map;
 
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
@@ -30,6 +29,8 @@
 import org.apache.excalibur.source.SourceFactory;
 import org.apache.excalibur.source.SourceResolver;
 
+import org.apache.cocoon.util.AbstractLogEnabled;
+
 /**
  * Implementation of a {@link Source} that gets its content from
  * a ZIP archive.
@@ -56,7 +57,7 @@
         this.manager = manager;
     }
 
-    public Source getSource(String location, Map parameters) throws IOException, MalformedURLException {
+    public Source getSource(String location, Map parameters) throws IOException {
         // Checks URL syntax
         int protocolEnd = location.indexOf(":");
         if (protocolEnd == -1) {
@@ -104,5 +105,4 @@
             this.manager.release(resolver);
         }
     }
-    
 }

Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxErrorListener.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxErrorListener.java?rev=585662&r1=585661&r2=585662&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxErrorListener.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxErrorListener.java Wed Oct 17 13:11:29 2007
@@ -19,7 +19,7 @@
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.TransformerException;
 
-import org.apache.avalon.framework.logger.Logger;
+import org.apache.cocoon.util.AbstractLogEnabled;
 import org.apache.cocoon.util.location.Location;
 import org.apache.cocoon.util.location.LocationUtils;
 
@@ -30,9 +30,9 @@
  * @version $Id$
  * @since 2.1.8
  */
-public class TraxErrorListener implements ErrorListener{
+public class TraxErrorListener extends AbstractLogEnabled
+                               implements ErrorListener {
 
-    private Logger logger;
     private String uri;
     
     /** The exception we had from warning() */
@@ -41,8 +41,8 @@
     /** The exception we had from error() or fatalError() */
     private TransformerException exception;
 
-    public TraxErrorListener(Logger logger, String uri) {
-        this.logger = logger;
+
+    public TraxErrorListener(String uri) {
         this.uri = uri;
     }
 
@@ -77,10 +77,11 @@
         // log levels. This can include also deprecation logs for system-defined stylesheets
         // using "DEPRECATED:WARN:Styling 'foo' is replaced by 'bar'".    
 
-        if (logger.isWarnEnabled()) {
+        if (getLogger().isWarnEnabled()) {
             Location loc = LocationUtils.getLocation(ex);
-            logger.warn(ex.getMessage() + " at "+ loc == null ? uri : loc.toString());
+            getLogger().warn(ex.getMessage() + " at " + (loc == null ? uri : loc.toString()));
         }
+
         // Keep the warning (see below)
         warningEx = ex;
     }

Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java?rev=585662&r1=585661&r2=585662&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java Wed Oct 17 13:11:29 2007
@@ -25,7 +25,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import javax.xml.transform.Result;
 import javax.xml.transform.Templates;
 import javax.xml.transform.Transformer;
@@ -40,15 +39,12 @@
 import org.apache.avalon.excalibur.pool.Recyclable;
 import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.parameters.ParameterException;
 import org.apache.avalon.framework.parameters.Parameterizable;
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.components.source.util.SourceUtil;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceException;
 import org.apache.excalibur.source.SourceResolver;
@@ -59,6 +55,11 @@
 import org.apache.excalibur.xml.sax.XMLizable;
 import org.apache.excalibur.xml.xslt.XSLTProcessor;
 import org.apache.excalibur.xml.xslt.XSLTProcessorException;
+
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.components.source.util.SourceUtil;
+import org.apache.cocoon.util.AbstractLogEnabled;
+
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -206,12 +207,12 @@
                 }
                 return handlerAndValidity;
             }
-        } catch(Exception e) {
+        } catch (Exception e) {
             throw new XSLTProcessorException("Error retrieving template", e);
         }
 
-        TraxErrorListener errorListener = new TraxErrorListener(getLogger(), stylesheet.getURI());
-        try{
+        TraxErrorListener errorListener = new TraxErrorListener(stylesheet.getURI());
+        try {
             if (getLogger().isDebugEnabled()) {
                 getLogger().debug("Creating new Templates for " + id);
             }
@@ -264,7 +265,7 @@
 
                 // Create transformer handler
                 final TransformerHandler handler = m_factory.newTransformerHandler(template);
-                handler.getTransformer().setErrorListener(new TraxErrorListener(getLogger(), stylesheet.getURI()));
+                handler.getTransformer().setErrorListener(new TraxErrorListener(stylesheet.getURI()));
                 handler.getTransformer().setURIResolver(this);
 
                 // Create aggregated validity
@@ -284,8 +285,9 @@
                 // Create result
                 handlerAndValidity = new MyTransformerHandlerAndValidity(handler, validity);
             } finally {
-                if (m_checkIncludes)
+                if (m_checkIncludes) {
                     m_includesMap.remove(id);
+                }
             }
 
             return handlerAndValidity;
@@ -308,7 +310,7 @@
     }
 
     private void sourceToSAX(Source source, ContentHandler handler)
-    throws SAXException, IOException, SourceException, ProcessingException {
+    throws SAXException, IOException, ProcessingException {
         if (source instanceof XMLizable) {
             ((XMLizable) source).toSAX(handler);
         } else {
@@ -320,8 +322,8 @@
     throws XSLTProcessorException {
         try {
             if (getLogger().isDebugEnabled()) {
-                getLogger().debug(
-                        "Transform source = " + source + ", stylesheet = " + stylesheet + ", parameters = " + params + ", result = " + result);
+                getLogger().debug("Transform source = " + source + ", stylesheet = " + stylesheet +
+                                  ", parameters = " + params + ", result = " + result);
             }
             final TransformerHandler handler = getTransformerHandler(stylesheet);
             if (params != null) {
@@ -396,7 +398,7 @@
             }
         }
 
-        _factory.setErrorListener(new TraxErrorListener(getLogger(), null));
+        _factory.setErrorListener(new TraxErrorListener(null));
         _factory.setURIResolver(this);
 
         // FIXME (SM): implementation-specific parameter passing should be
@@ -488,7 +490,7 @@
         }
 
         TransformerHandler handler = m_factory.newTransformerHandler((Templates) templateAndValidityAndIncludes[0]);
-        handler.getTransformer().setErrorListener(new TraxErrorListener(getLogger(), stylesheet.getURI()));
+        handler.getTransformer().setErrorListener(new TraxErrorListener(stylesheet.getURI()));
         handler.getTransformer().setURIResolver(this);
         return new MyTransformerHandlerAndValidity(handler, storedValidity);
     }
@@ -618,7 +620,7 @@
      * @throws IOException
      *             if I/O error occured.
      */
-    private static InputSource getInputSource(final Source source) throws IOException, SourceException {
+    private static InputSource getInputSource(final Source source) throws IOException {
         final InputSource newObject = new InputSource(source.getInputStream());
         newObject.setSystemId(source.getURI());
         return newObject;

Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java?rev=585662&r1=585661&r2=585662&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java Wed Oct 17 13:11:29 2007
@@ -51,6 +51,7 @@
  *
  * @since 2.1
  * @version $Id$
+ * @noinspection SynchronizeOnNonFinalField
  */
 public abstract class AbstractCachingProcessingPipeline extends BaseCachingProcessingPipeline {
 
@@ -93,6 +94,7 @@
     /** Cache complete response */
     protected boolean cacheCompleteResponse;
 
+    /** Store for pipeline locks (optional) */
     protected Store transientStore;
 
 
@@ -118,8 +120,7 @@
     public void parameterize(Parameters params) throws ParameterException {
         super.parameterize(params);
 
-        String storeRole = params.getParameter("store-role",Store.TRANSIENT_STORE);
-
+        String storeRole = params.getParameter("store-role", Store.TRANSIENT_STORE);
         try {
             transientStore = (Store) manager.lookup(storeRole);
         } catch (ServiceException e) {
@@ -167,13 +168,11 @@
 
     protected boolean waitForLock(Object key) {
         if (transientStore != null) {
-            Object lock = null;
+            // Get a lock object from the store
+            String lockKey = PIPELOCK_PREFIX + key;
+            Object lock;
             synchronized (transientStore) {
-                String lockKey = PIPELOCK_PREFIX + key;
-                if (transientStore.containsKey(lockKey)) {
-                    // cache content is currently being generated, wait for other thread
-                    lock = transientStore.get(lockKey);
-                }
+                lock = transientStore.get(lockKey);
             }
 
             // Avoid deadlock with self (see JIRA COCOON-1985).
@@ -185,7 +184,7 @@
                     }
                 } catch (InterruptedException e) {
                     if (getLogger().isDebugEnabled()) {
-                        getLogger().debug("Got interrupted waiting for other pipeline to finish processing, retrying...", e);
+                        getLogger().debug("Interrupted waiting for other pipeline to finish processing, retrying...", e);
                     }
                     return false;
                 }
@@ -207,6 +206,7 @@
 
         if (transientStore != null && key != null) {
             String lockKey = PIPELOCK_PREFIX + key;
+
             synchronized (transientStore) {
                 if (transientStore.containsKey(lockKey)) {
                     succeeded = false;
@@ -238,6 +238,7 @@
 
         if (transientStore != null && key != null) {
             String lockKey = PIPELOCK_PREFIX + key;
+
             Object lock = null;
             synchronized (transientStore) {
                 if (!transientStore.containsKey(lockKey)) {
@@ -311,7 +312,6 @@
             }
 
             generateLock(this.toCacheKey);
-
             try {
                 OutputStream os = null;
 
@@ -412,15 +412,15 @@
         // is the generator cacheable?
         Serializable key = null;
         if (super.generator instanceof CacheableProcessingComponent) {
-            key = ((CacheableProcessingComponent)super.generator).getKey();
+            key = ((CacheableProcessingComponent) super.generator).getKey();
         }
 
         if (key != null) {
             this.toCacheKey = new PipelineCacheKey();
             this.toCacheKey.addKey(
-                    this.newComponentCacheKey(
-                        ComponentCacheKey.ComponentType_Generator,
-                        this.generatorRole, key));
+                    newComponentCacheKey(
+                            ComponentCacheKey.ComponentType_Generator,
+                            this.generatorRole, key));
 
             // now testing transformers
             final int transformerSize = super.transformers.size();
@@ -435,11 +435,10 @@
                 }
                 if (key != null) {
                     this.toCacheKey.addKey(
-                            this.newComponentCacheKey(
-                                ComponentCacheKey.ComponentType_Transformer,
-                                (String)this.transformerRoles.get(
-                                                                  this.firstNotCacheableTransformerIndex),
-                                key));
+                            newComponentCacheKey(
+                                    ComponentCacheKey.ComponentType_Transformer,
+                                    (String) this.transformerRoles.get(this.firstNotCacheableTransformerIndex),
+                                    key));
 
                     this.firstNotCacheableTransformerIndex++;
                 } else {
@@ -453,7 +452,7 @@
 
                 key = null;
                 if (super.serializer instanceof CacheableProcessingComponent) {
-                    key = ((CacheableProcessingComponent)this.serializer).getKey();
+                    key = ((CacheableProcessingComponent) this.serializer).getKey();
                 }
                 if (key != null) {
                     this.toCacheKey.addKey(
@@ -660,7 +659,6 @@
                             for(int x=0; x < deleteCount; x++) {
                                 this.toCacheKey.removeLastKey();
                             }
-                            finished = false;
                         } else {
                             this.toCacheKey = null;
                         }
@@ -679,12 +677,13 @@
                     } else {
                         this.fromCacheKey = null;
                     }
+
                     finished = false;
                     this.completeResponseIsCached = false;
                 }
             } else {
                 // check if there might be one being generated
-                if(!waitForLock(this.fromCacheKey)) {
+                if (!waitForLock(this.fromCacheKey)) {
                     finished = false;
                     continue;
                 }
@@ -826,7 +825,7 @@
                         }
                     } else {
                         // check if something is being generated right now
-                        if(!waitForLock(pcKey)) {
+                        if (!waitForLock(pcKey)) {
                             finished = false;
                             continue;
                         }
@@ -881,11 +880,8 @@
                     }
 
                 } finally {
-                    if (pcKey != null) {
-                        releaseLock(pcKey);
-                    }
+                    releaseLock(pcKey);
                 }
-
             }
         } catch (Exception e) {
             handleException(e);

Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/BaseCachingProcessingPipeline.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/BaseCachingProcessingPipeline.java?rev=585662&r1=585661&r2=585662&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/BaseCachingProcessingPipeline.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-impl/src/main/java/org/apache/cocoon/components/pipeline/impl/BaseCachingProcessingPipeline.java Wed Oct 17 13:11:29 2007
@@ -37,7 +37,7 @@
                                                     implements Disposable {
 
     /** This is the Cache holding cached responses */
-    protected Cache  cache;
+    protected Cache cache;
 
     /** The deserializer */
     protected XMLByteStreamInterpreter xmlDeserializer;