vgritsenko    2003/01/24 18:21:46

  Modified:    src/blocks/itext/java/org/apache/cocoon/serialization
                        iTextSerializer.java
               src/blocks/precept/java/org/apache/cocoon/precept
                        InstanceFactory.java
               src/blocks/precept/java/org/apache/cocoon/precept/acting
                        AbstractMethodAction.java
               src/blocks/precept/java/org/apache/cocoon/precept/stores/bean
                        InstanceImpl.java
  Log:
  conf in configure() never null. some style changes.
  
  Revision  Changes    Path
  1.3       +4 -7      
xml-cocoon2/src/blocks/itext/java/org/apache/cocoon/serialization/iTextSerializer.java
  
  Index: iTextSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/blocks/itext/java/org/apache/cocoon/serialization/iTextSerializer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- iTextSerializer.java      7 Jan 2003 23:56:09 -0000       1.2
  +++ iTextSerializer.java      25 Jan 2003 02:21:46 -0000      1.3
  @@ -76,13 +76,10 @@
       private Document document = null;
   
       public void configure(Configuration conf) throws ConfigurationException {
  -        if (conf != null) {
  -            this.setContentLength = 
conf.getChild("set-content-length").getValueAsBoolean(true);
  -            this.mimetype = conf.getAttribute("mime-type");
  -            getLogger().debug("iTextSerializer mime-type:" + mimetype);
  -        }
  -
  -        document = new Document();
  +        this.setContentLength = 
conf.getChild("set-content-length").getValueAsBoolean(true);
  +        this.mimetype = conf.getAttribute("mime-type");
  +        getLogger().debug("iTextSerializer mime-type:" + mimetype);
  +        this.document = new Document();
       }
   
       public String getMimeType() {
  
  
  
  1.4       +6 -10     
xml-cocoon2/src/blocks/precept/java/org/apache/cocoon/precept/InstanceFactory.java
  
  Index: InstanceFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/blocks/precept/java/org/apache/cocoon/precept/InstanceFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- InstanceFactory.java      12 Jan 2003 16:31:18 -0000      1.3
  +++ InstanceFactory.java      25 Jan 2003 02:21:46 -0000      1.4
  @@ -82,24 +82,20 @@
       public void configure(Configuration conf) throws ConfigurationException {
           instanceConfigurationMap = new HashMap();
           Configuration[] instances = conf.getChildren("instance");
  -
  -        if (instances != null) {
  +        if (instances.length > 0) {
               for (int p = 0; p < instances.length; p++) {
                   Configuration instance = instances[p];
                   String name = instance.getAttribute("name");
  -                getLogger().debug("registering instance [name=" + 
String.valueOf(name) + ";impl=" + String.valueOf(instance.getAttribute("impl")) + "]");
  +                getLogger().debug("registering instance [name=" + name
  +                                  + ";impl=" + instance.getAttribute("impl") + "]");
                   if (instanceConfigurationMap.containsKey(name)) {
  -
  -                    getLogger().error("instance [name=" + String.valueOf(name) + "] 
appears more than once");
  -
  -                    throw new ConfigurationException("instance [name=" + 
String.valueOf(name) + "] appears more than once");
  -
  +                    getLogger().error("instance [name=" + name + "] appears more 
than once");
  +                    throw new ConfigurationException("instance [name=" + name + "] 
appears more than once");
                   }
   
                   instanceConfigurationMap.put(name, instance);
               }
  -        }
  -        else {
  +        } else {
               getLogger().warn("no instances are configured");
           }
       }
  
  
  
  1.4       +1 -3      
xml-cocoon2/src/blocks/precept/java/org/apache/cocoon/precept/acting/AbstractMethodAction.java
  
  Index: AbstractMethodAction.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/blocks/precept/java/org/apache/cocoon/precept/acting/AbstractMethodAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractMethodAction.java 12 Jan 2003 16:31:18 -0000      1.3
  +++ AbstractMethodAction.java 25 Jan 2003 02:21:46 -0000      1.4
  @@ -105,7 +105,6 @@
           super.configure(conf);
   
           if (methodIndex == null) {
  -
               try {
                   Method[] methods = this.getClass().getMethods();
                   methodIndex = new HashMap();
  @@ -123,8 +122,7 @@
                           }
                       }
                   }
  -            }
  -            catch (Exception e) {
  +            } catch (Exception e) {
                   throw new ConfigurationException("cannot get methods by 
reflection", e);
               }
           }
  
  
  
  1.3       +9 -15     
xml-cocoon2/src/blocks/precept/java/org/apache/cocoon/precept/stores/bean/InstanceImpl.java
  
  Index: InstanceImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/blocks/precept/java/org/apache/cocoon/precept/stores/bean/InstanceImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- InstanceImpl.java 12 Jan 2003 16:31:19 -0000      1.2
  +++ InstanceImpl.java 25 Jan 2003 02:21:46 -0000      1.3
  @@ -105,7 +105,7 @@
       }
   
       public void configure(Configuration configuration) throws 
ConfigurationException {
  -        Configuration clazzConf = configuration.getChild("class");
  +        Configuration clazzConf = configuration.getChild("class", false);
           if (clazzConf != null) {
               ClassLoaderManager clazzLoader = null;
               try {
  @@ -116,29 +116,23 @@
                       mapping = new Mapping();
                       // resolve
                       //mapping.loadMapping(getFile(resolver,mappingURI));
  -                    getLogger().debug("bean class = [" + String.valueOf(clazzName) 
+ "] mapping [" + String.valueOf(mappingURI) + "]");
  -                }
  -                else {
  -                    getLogger().debug("bean class = [" + String.valueOf(clazzName) 
+ "] using default mapping");
  +                    getLogger().debug("bean class = [" + clazzName + "] mapping [" 
+ mappingURI + "]");
  +                } else {
  +                    getLogger().debug("bean class = [" + clazzName + "] using 
default mapping");
                   }
   
                   clazzLoader = (ClassLoaderManager) 
manager.lookup(ClassLoaderManager.ROLE);
                   Class clazz = clazzLoader.loadClass(clazzName);
                   setBean(clazz.newInstance());
  -            }
  -            catch (ComponentException e) {
  +            } catch (ComponentException e) {
                   throw new ConfigurationException("", e);
  -            }
  -            catch (ClassNotFoundException e) {
  +            } catch (ClassNotFoundException e) {
                   throw new ConfigurationException("", e);
  -            }
  -            catch (InstantiationException e) {
  +            } catch (InstantiationException e) {
                   throw new ConfigurationException("", e);
  -            }
  -            catch (IllegalAccessException e) {
  +            } catch (IllegalAccessException e) {
                   throw new ConfigurationException("", e);
  -            }
  -            finally {
  +            } finally {
                   manager.release(clazzLoader);
               }
           }
  
  
  

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