cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/xslt XSLTProcessorImpl.java
Date Tue, 17 Dec 2002 14:58:32 GMT
haul        2002/12/17 06:58:32

  Modified:    src/java/org/apache/cocoon/components/language/generator
                        GeneratorSelector.java
               src/java/org/apache/cocoon/components/language/markup/xsp/java
                        sendmail.xsl
               src/java/org/apache/cocoon/components/parser JaxpParser.java
                        XercesParser.java
               src/java/org/apache/cocoon/components/store
                        JispFilesystemStore.java MRUMemoryStore.java
                        StoreJanitorImpl.java
               src/java/org/apache/cocoon/components/url
                        URLFactoryImpl.java
               src/java/org/apache/cocoon/components/xslt
                        XSLTProcessorImpl.java
  Log:
    <action dev="CH" type="fix" due-to-email="stuart.roebuck@adolos.co.uk"
     due-to="Stuart Roebuck" fixes-bug="15136">
     Fixing various inefficient logging calls.
    </action>
  
  Revision  Changes    Path
  1.15      +9 -4      xml-cocoon2/src/java/org/apache/cocoon/components/language/generator/GeneratorSelector.java
  
  Index: GeneratorSelector.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/generator/GeneratorSelector.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- GeneratorSelector.java	5 Dec 2002 09:48:53 -0000	1.14
  +++ GeneratorSelector.java	17 Dec 2002 14:58:32 -0000	1.15
  @@ -160,7 +160,8 @@
               componentMapping.put(component, handler);
               return component;
           } catch (Exception ce) {
  -            getLogger().debug("Could not access component for hint: " + hint, ce);
  +            if (getLogger().isDebugEnabled())
  +                getLogger().debug("Could not access component for hint: " + hint, ce);
               throw new ComponentException(ROLE, "Could not access component for hint: "
+ hint, ce);
           }
       }
  @@ -190,7 +191,9 @@
               }
           } catch(final Exception e) {
               // Error will be logged by caller. This is for debug only
  -            getLogger().debug("Could not set up Component for hint: " + hint, e);
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("Could not set up Component for hint: " + hint, e);
  +            }
               throw e;
           }
       }
  @@ -200,7 +203,9 @@
           if (handler != null) {
               handler.dispose();
               this.classManager.reinstantiate();
  -            getLogger().debug("Removing " + handler.getClass().getName() + " for " + hint.toString());
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("Removing " + handler.getClass().getName() + " for "
+ hint.toString());
  +            }
           }
       }
   
  
  
  
  1.8       +4 -4      xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/sendmail.xsl
  
  Index: sendmail.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/sendmail.xsl,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- sendmail.xsl	28 Apr 2002 19:12:15 -0000	1.7
  +++ sendmail.xsl	17 Dec 2002 14:58:32 -0000	1.8
  @@ -257,8 +257,8 @@
   
         <xsl:if test="sendmail:cc">
            if (!"null".equals(String.valueOf(<xsl:copy-of select="$cc"/>))){
  -            InternetAddress _sendmail_cc = new InternetAddress(String.valueOf(<xsl:copy-of
select="$cc"/>));
  -            _sendmail_message.setRecipient(Message.RecipientType.CC,_sendmail_cc);
  +            InternetAddress [] _sendmail_cc = InternetAddress.parse(String.valueOf(<xsl:copy-of
select="$cc"/>));
  +            _sendmail_message.setRecipients(Message.RecipientType.CC,_sendmail_cc);
            }
         </xsl:if>
         <xsl:if test="sendmail:bcc">
  
  
  
  1.10      +4 -2      xml-cocoon2/src/java/org/apache/cocoon/components/parser/JaxpParser.java
  
  Index: JaxpParser.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/parser/JaxpParser.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JaxpParser.java	22 Feb 2002 07:00:10 -0000	1.9
  +++ JaxpParser.java	17 Dec 2002 14:58:32 -0000	1.10
  @@ -143,7 +143,9 @@
       throws ComponentException {
           this.manager = manager;
           if ( manager.hasComponent( Resolver.ROLE ) ) {
  -            getLogger().debug("Looking up " + Resolver.ROLE);
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("Looking up " + Resolver.ROLE);
  +            }
               this.resolver = (Resolver)manager.lookup(Resolver.ROLE);
           }
       }
  
  
  
  1.9       +4 -2      xml-cocoon2/src/java/org/apache/cocoon/components/parser/XercesParser.java
  
  Index: XercesParser.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/parser/XercesParser.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XercesParser.java	22 Feb 2002 07:00:10 -0000	1.8
  +++ XercesParser.java	17 Dec 2002 14:58:32 -0000	1.9
  @@ -102,7 +102,9 @@
        */
       public void compose(ComponentManager manager) throws ComponentException {
           this.manager = manager;
  -        getLogger().debug("Looking up " + Resolver.ROLE);
  +        if (getLogger().isDebugEnabled()) {
  +            getLogger().debug("Looking up " + Resolver.ROLE);
  +        }
           if ( manager.hasComponent( Resolver.ROLE ) ) {
               this.resolver = (Resolver)manager.lookup(Resolver.ROLE);
           }
  
  
  
  1.10      +7 -3      xml-cocoon2/src/java/org/apache/cocoon/components/store/JispFilesystemStore.java
  
  Index: JispFilesystemStore.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/store/JispFilesystemStore.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JispFilesystemStore.java	5 Dec 2002 10:17:30 -0000	1.9
  +++ JispFilesystemStore.java	17 Dec 2002 14:58:32 -0000	1.10
  @@ -273,9 +273,13 @@
               value = m_Database.read(this.wrapKeyObject(key), m_Index);
               if (getLogger().isDebugEnabled()) {
                   if (value != null) {
  -                    getLogger().debug("Found key: " + key);
  +                    if (getLogger().isDebugEnabled()) {
  +                        getLogger().debug("Found key: " + key);
  +                    }
                   } else {
  -                    getLogger().debug("NOT Found key: " + key);
  +                    if (getLogger().isDebugEnabled()) {
  +                        getLogger().debug("NOT Found key: " + key);
  +                    }
                   }
               }
           } catch (Exception e) {
  
  
  
  1.18      +4 -2      xml-cocoon2/src/java/org/apache/cocoon/components/store/MRUMemoryStore.java
  
  Index: MRUMemoryStore.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/store/MRUMemoryStore.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- MRUMemoryStore.java	31 Jul 2002 13:13:26 -0000	1.17
  +++ MRUMemoryStore.java	17 Dec 2002 14:58:32 -0000	1.18
  @@ -148,7 +148,9 @@
   
               // save all cache entries to filesystem
               if (this.persistent) {
  -                getLogger().debug("Final cache size: " + this.cache.size());
  +                if (getLogger().isDebugEnabled()) {
  +                    getLogger().debug("Final cache size: " + this.cache.size());
  +                }
                   Enumeration enum = this.cache.keys();
                   while (enum.hasMoreElements()) {
                       Object key = enum.nextElement();
  
  
  
  1.16      +5 -3      xml-cocoon2/src/java/org/apache/cocoon/components/store/StoreJanitorImpl.java
  
  Index: StoreJanitorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/store/StoreJanitorImpl.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- StoreJanitorImpl.java	6 Sep 2002 03:04:15 -0000	1.15
  +++ StoreJanitorImpl.java	17 Dec 2002 14:58:32 -0000	1.16
  @@ -319,7 +319,7 @@
       }
   
       /**
  -     * This method claculates the number of Elements to be freememory
  +     * This method calculates the number of Elements to be freememory
        * out of the Cache.
        *
        * @param store the Store which was selected as victim
  @@ -328,7 +328,9 @@
       private int calcToFree(Store store) {
           int cnt = store.size();
           if (cnt < 0) {
  -            getLogger().debug("Unknown size of the store: " + store);
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("Unknown size of the store: " + store);
  +            }
               return 0;
           }
           return (int)(cnt * fraction);
  
  
  
  1.10      +16 -6     xml-cocoon2/src/java/org/apache/cocoon/components/url/URLFactoryImpl.java
  
  Index: URLFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/url/URLFactoryImpl.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- URLFactoryImpl.java	5 Dec 2002 10:17:31 -0000	1.9
  +++ URLFactoryImpl.java	17 Dec 2002 14:58:32 -0000	1.10
  @@ -117,10 +117,14 @@
               }
           }
           try {
  -            getLogger().debug("Making URL from " + location);
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("Making URL from " + location);
  +            }
               return new URL(location);
           } catch (MalformedURLException mue) {
  -            getLogger().debug("Making URL - MalformedURLException in getURL:" , mue);
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("Making URL - MalformedURLException in getURL:" , mue);
  +            }
   
               org.apache.cocoon.environment.Context envContext = null;
               try {
  @@ -134,12 +138,16 @@
               if (path != null)
                   return (new File(path)).toURL();
   
  -            getLogger().debug("Making URL a Resource:" + location);
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("Making URL a Resource:" + location);
  +            }
               URL url = envContext.getResource(location);
               if(url != null)
                   return url;
   
  -            getLogger().debug("Making URL a File (assuming that it is full path):" + location);
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("Making URL a File (assuming that it is full path):"
+ location);
  +            }
               return (new File(location)).toURL();
           }
       }
  @@ -188,7 +196,9 @@
                   if (factories.containsKey(protocol)) {
                       throw new ConfigurationException("URLFactory defined twice for protocol:
" + protocol);
                   }
  -                getLogger().debug("\tfor protocol: " + protocol + " " + configs[i].getAttribute("class"));
  +                if (getLogger().isDebugEnabled()) {
  +                    getLogger().debug("\tfor protocol: " + protocol + " " + configs[i].getAttribute("class"));
  +                }
                   urlFactory = (URLFactory) ClassUtils.newInstance(configs[i].getAttribute("class"));
                   this.init(urlFactory, configs[i]);
                   factories.put(protocol, urlFactory);
  
  
  
  1.28      +18 -11    xml-cocoon2/src/java/org/apache/cocoon/components/xslt/XSLTProcessorImpl.java
  
  Index: XSLTProcessorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/xslt/XSLTProcessorImpl.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- XSLTProcessorImpl.java	5 Dec 2002 10:17:31 -0000	1.27
  +++ XSLTProcessorImpl.java	17 Dec 2002 14:58:32 -0000	1.28
  @@ -147,7 +147,8 @@
       public void compose(ComponentManager manager)
       throws ComponentException {
           this.manager = manager;
  -        this.getLogger().debug("XSLTProcessorImpl component initialized.");
  +        if (this.getLogger().isDebugEnabled())
  +            this.getLogger().debug("XSLTProcessorImpl component initialized.");
           this.store = (Store) manager.lookup(Store.TRANSIENT_STORE);
           this.errorHandler = new TraxErrorHandler( this.getLogger() );
           this.resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
  @@ -252,7 +253,8 @@
               if (e.getException() == null) {
                   throw new ProcessingException("Exception in creating Transform Handler",
e);
               } else {
  -                getLogger().debug("Got SAXException. Rethrowing cause exception.", e);
  +                if (getLogger().isDebugEnabled())
  +                    getLogger().debug("Got SAXException. Rethrowing cause exception.",
e);
                   throw new ProcessingException("Exception in creating Transform Handler",
e.getException());
               }
           } catch (Exception e) {
  @@ -283,12 +285,14 @@
                   }
               }
   
  -            this.getLogger().debug("XSLTProcessorImpl: starting transform");
  +            if (getLogger().isDebugEnabled())
  +                this.getLogger().debug("XSLTProcessorImpl: starting transform");
               // FIXME (VG): Is it possible to use Source's toSAX method?
               handler.setResult(result);
               source.toSAX(handler);
   
  -            this.getLogger().debug("XSLTProcessorImpl: transform done");
  +            if (getLogger().isDebugEnabled())
  +                this.getLogger().debug("XSLTProcessorImpl: transform done");
           } catch (Exception e) {
               throw new ProcessingException("Error in running Transformation", e);
           }
  @@ -308,18 +312,21 @@
               try {
                   _factory = (SAXTransformerFactory) ClassUtils.loadClass(factoryName).newInstance();
               } catch (ClassNotFoundException cnfe) {
  -                getLogger().error("Cannot find the requested TrAX factory '" + factoryName
  -                        + "'. Using default TrAX Transformer Factory instead.");
  +                if (getLogger().isErrorEnabled())
  +                    getLogger().error("Cannot find the requested TrAX factory '" + factoryName
  +                                      + "'. Using default TrAX Transformer Factory instead.");
                   if (this.factory != null) return this.factory;
                   _factory = (SAXTransformerFactory) TransformerFactory.newInstance();
               } catch (ClassCastException cce) {
  -                getLogger().error("The indicated class '" + factoryName
  -                        + "' is not a TrAX Transformer Factory. Using default TrAX Transformer
Factory instead.");
  +                if (getLogger().isErrorEnabled())
  +                    getLogger().error("The indicated class '" + factoryName
  +                                      + "' is not a TrAX Transformer Factory. Using default
TrAX Transformer Factory instead.");
                   if (this.factory != null) return this.factory;
                   _factory = (SAXTransformerFactory) TransformerFactory.newInstance();
               } catch (Exception e) {
  -                getLogger().error("Error found loading the requested TrAX Transformer Factory
'"
  -                        + factoryName + "'. Using default TrAX Transformer Factory instead.");
  +                if (getLogger().isErrorEnabled())
  +                    getLogger().error("Error found loading the requested TrAX Transformer
Factory '"
  +                                      + factoryName + "'. Using default TrAX Transformer
Factory instead.");
                   if (this.factory != null) return this.factory;
                   _factory = (SAXTransformerFactory) TransformerFactory.newInstance();
               }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message