cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/pipeline AbstractProcessingPipeline.java
Date Wed, 04 Feb 2004 15:15:00 GMT
sylvain     2004/02/04 07:14:59

  Modified:    src/java/org/apache/cocoon/components/pipeline
                        AbstractProcessingPipeline.java
  Log:
  Give more meaningful messages with location information
  
  Revision  Changes    Path
  1.13      +37 -19    cocoon-2.1/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
  
  Index: AbstractProcessingPipeline.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- AbstractProcessingPipeline.java	31 Jan 2004 13:07:53 -0000	1.12
  +++ AbstractProcessingPipeline.java	4 Feb 2004 15:14:59 -0000	1.13
  @@ -60,6 +60,7 @@
   import org.apache.avalon.framework.parameters.Parameterizable;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.ConnectionResetException;
  +import org.apache.cocoon.Constants;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.CocoonComponentManager;
   import org.apache.cocoon.environment.Environment;
  @@ -239,20 +240,22 @@
       public void setGenerator (String role, String source, Parameters param, Parameters
hintParam)
       throws ProcessingException {
           if (this.generator != null) {
  -            throw new ProcessingException ("Generator already set. You can only select
one Generator (" + role + ")");
  +            throw new ProcessingException ("Generator already set. Cannot set generator
'" + role +
  +                "' at " + getLocation(param));
           }
           if (this.reader != null) {
  -            throw new ProcessingException ("Reader already set. You cannot use a reader
and a generator for one pipeline.");
  +            throw new ProcessingException ("Reader already set. Cannot set generator '"
+ role +
  +                "' at " + getLocation(param));
           }
           try {
               this.generatorSelector = (ComponentSelector) this.newManager.lookup(Generator.ROLE
+ "Selector");
           } catch (ComponentException ce) {
  -            throw new ProcessingException("Lookup of generator selector failed.", ce);
  +            throw new ProcessingException("Lookup of generator selector failed at " +getLocation(param),
ce);
           }
           try {
               this.generator = (Generator) this.generatorSelector.select(role);
           } catch (ComponentException ce) {
  -            throw new ProcessingException("Lookup of generator for role '"+role+"' failed.",
ce);
  +            throw new ProcessingException("Lookup of generator '" + role + "' failed at
" + getLocation(param), ce);
           }
           this.generatorSource = source;
           this.generatorParam = param;
  @@ -273,22 +276,25 @@
       public void addTransformer (String role, String source, Parameters param, Parameters
hintParam)
       throws ProcessingException {
           if (this.reader != null) {
  -            throw new ProcessingException ("Reader already set. You cannot use a transformer
with a reader.");
  +            // Should normally never happen as setting a reader starts pipeline processing
  +            throw new ProcessingException ("Reader already set. Cannot add transformer
'" + role +
  +                "' at " + getLocation(param));
           }
           if (this.generator == null) {
  -            throw new ProcessingException ("You must set a generator first before you can
use a transformer.");
  +            throw new ProcessingException ("Must set a generator before adding transformer
'" + role +
  +                "' at " + getLocation(param));
           }
           ComponentSelector selector = null;
           try {
               selector = (ComponentSelector) this.newManager.lookup(Transformer.ROLE + "Selector");
           } catch (ComponentException ce) {
  -            throw new ProcessingException("Lookup of transformer selector failed.", ce);
  +            throw new ProcessingException("Lookup of transformer selector failed at " +
getLocation(param), ce);
           }
           try {
               this.transformers.add(selector.select(role));
               this.transformerSelectors.add(selector);
           } catch (ComponentException ce) {
  -            throw new ProcessingException("Lookup of transformer for role '"+role+"' failed.",
ce);
  +            throw new ProcessingException("Lookup of transformer '"+role+"' failed at "
+ getLocation(param), ce);
           }
           this.transformerSources.add(source);
           this.transformerParams.add(param);
  @@ -301,24 +307,29 @@
       public void setSerializer (String role, String source, Parameters param, Parameters
hintParam, String mimeType)
       throws ProcessingException {
           if (this.serializer != null) {
  -            throw new ProcessingException ("Serializer already set. You can only select
one Serializer (" + role + ")");
  +            // Should normally not happen as adding a serializer starts pipeline processing
  +            throw new ProcessingException ("Serializer already set. Cannot set serializer
'" + role +
  +                "' at " + getLocation(param));
           }
           if (this.reader != null) {
  -            throw new ProcessingException ("Reader already set. You cannot use a serializer
with a reader.");
  +            // Should normally never happen as setting a reader starts pipeline processing
  +            throw new ProcessingException ("Reader already set. Cannot set serializer '"
+ role +
  +                "' at " + getLocation(param));
           }
           if (this.generator == null) {
  -            throw new ProcessingException ("You must set a generator first before you can
use a serializer.");
  +            throw new ProcessingException ("Must set a generator before setting serializer
'" + role +
  +                "' at " + getLocation(param));
           }
   
           try {
               this.serializerSelector = (OutputComponentSelector) this.newManager.lookup(Serializer.ROLE
+ "Selector");
           } catch (ComponentException ce) {
  -            throw new ProcessingException("Lookup of serializer selector failed.", ce);
  +            throw new ProcessingException("Lookup of serializer selector failed at " +
getLocation(param), ce);
           }
           try {
               this.serializer = (Serializer)serializerSelector.select(role);
           } catch (ComponentException ce) {
  -            throw new ProcessingException("Lookup of serializer for role '"+role+"' failed.",
ce);
  +            throw new ProcessingException("Lookup of serializer '" + role + "' failed at
" + getLocation(param), ce);
           }
           this.serializerSource = source;
           this.serializerParam = param;
  @@ -334,21 +345,25 @@
       public void setReader (String role, String source, Parameters param, String mimeType)
       throws ProcessingException {
           if (this.reader != null) {
  -            throw new ProcessingException ("Reader already set. You can only select one
Reader (" + role + ")");
  +            // Should normally never happen as setting a reader starts pipeline processing
  +            throw new ProcessingException ("Reader already set. Cannot set reader '" +
role +
  +                "' at " + getLocation(param));
           }
           if (this.generator != null) {
  -            throw new ProcessingException ("Generator already set. You cannot use a reader
and a generator for one pipeline.");
  +            // Should normally never happen as setting a reader starts pipeline processing
  +            throw new ProcessingException ("Generator already set. Cannot use reader '"
+ role +
  +                "' at " + getLocation(param));
           }
   
           try {
               this.readerSelector = (OutputComponentSelector) this.newManager.lookup(Reader.ROLE
+ "Selector");
           } catch (ComponentException ce) {
  -            throw new ProcessingException("Lookup of reader selector failed.", ce);
  +            throw new ProcessingException("Lookup of reader selector failed at " + getLocation(param),
ce);
           }
           try {
               this.reader = (Reader)readerSelector.select(role);
           } catch (ComponentException ce) {
  -            throw new ProcessingException("Lookup of reader for role '"+role+"' failed.",
ce);
  +            throw new ProcessingException("Lookup of reader '"+role+"' failed at " + getLocation(param),
ce);
           }
           this.readerSource = source;
           this.readerParam = param;
  @@ -785,5 +800,8 @@
       public String getKeyForEventPipeline() {
           return null;
       }
  -
  +    
  +    protected String getLocation(Parameters param) {
  +        return param.getParameter(Constants.SITEMAP_PARAMETERS_LOCATION, "[unknown location]");
  +    }
   }
  
  
  

Mime
View raw message