cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/reading DatabaseReader.java ResourceReader.java JSPReader.java
Date Tue, 10 Sep 2002 12:15:49 GMT
cziegeler    2002/09/10 05:15:49

  Modified:    src/java/org/apache/cocoon/transformation
                        FragmentExtractorTransformer.java
                        CachingCIncludeTransformer.java LogTransformer.java
                        ReadDOMSessionTransformer.java LDAPTransformer.java
                        CIncludeTransformer.java I18nTransformer.java
               src/java/org/apache/cocoon/reading DatabaseReader.java
                        ResourceReader.java JSPReader.java
  Log:
  Fixing some logging and exception handling
  
  Revision  Changes    Path
  1.16      +10 -7     xml-cocoon2/src/java/org/apache/cocoon/transformation/FragmentExtractorTransformer.java
  
  Index: FragmentExtractorTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/FragmentExtractorTransformer.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- FragmentExtractorTransformer.java	28 May 2002 13:08:13 -0000	1.15
  +++ FragmentExtractorTransformer.java	10 Sep 2002 12:15:49 -0000	1.16
  @@ -261,12 +261,13 @@
           if (this.extractURI.equals(uri) && this.extractElement.equals(loc)) {
               extractLevel++;
               fragmentID++;
  -            getLogger().debug("FragmentExtractorTransformer extractLevel now " + extractLevel
+ ".");
  +            if (this.getLogger().isDebugEnabled()) {
  +                getLogger().debug("FragmentExtractorTransformer extractLevel now " + extractLevel
+ ".");
  +            }
   
               try {
                   this.serializer = (XMLSerializer) this.manager.lookup(XMLSerializer.ROLE);
               } catch (ComponentException ce) {
  -                getLogger().error("Could not lookup for XMLSerializer.", ce);
                   throw new SAXException("Could not lookup for XMLSerializer.", ce);
               }
   
  @@ -310,7 +311,9 @@
               this.serializer.endElement(uri,loc,raw);
               if (this.extractURI.equals(uri) && this.extractElement.equals(loc))
{
                   extractLevel--;
  -                getLogger().debug("FragmentExtractorTransformer extractLevel now " + extractLevel
+ ".");
  +                if (this.getLogger().isDebugEnabled()) {
  +                    getLogger().debug("FragmentExtractorTransformer extractLevel now "
+ extractLevel + ".");
  +                }
   
                   if (extractLevel == 0) {
                       // finish building the fragment. remove existing prefix mappings.
  @@ -330,10 +333,8 @@
   
                           store.store(id, this.serializer.getSAXFragment());
                       } catch (ComponentException ce) {
  -                        getLogger().error("Could not lookup for transient store.", ce);
                           throw new SAXException("Could not lookup for transient store.",
ce);
                       } catch (IOException ioe) {
  -                        getLogger().error("Could not store fragment.", ioe);
                           throw new SAXException("Could not store fragment.", ioe);
                       } finally
                       {
  @@ -342,7 +343,9 @@
                           this.serializer = null;
                       }
   
  -                    getLogger().debug("FragmentExtractorTransformer stored document " +
id + ".");
  +                    if (this.getLogger().isDebugEnabled()) {
  +                        getLogger().debug("FragmentExtractorTransformer stored document
" + id + ".");
  +                    }
   
                       // Insert ref.
                       super.startPrefixMapping("fe", FE_URI);
  
  
  
  1.9       +8 -7      xml-cocoon2/src/java/org/apache/cocoon/transformation/CachingCIncludeTransformer.java
  
  Index: CachingCIncludeTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/CachingCIncludeTransformer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- CachingCIncludeTransformer.java	13 Jun 2002 09:28:16 -0000	1.8
  +++ CachingCIncludeTransformer.java	10 Sep 2002 12:15:49 -0000	1.9
  @@ -179,10 +179,12 @@
           if (ns == null) ns="";
           if (prefix == null) prefix="";
   
  -        getLogger().debug("Processing CInclude element: src=" + src
  +        if (this.getLogger().isDebugEnabled()) {
  +            getLogger().debug("Processing CInclude element: src=" + src
                             + ", element=" + element
                             + ", ns=" + ns
                             + ", prefix=" + prefix);
  +        }
   
           // complete validity information
           if(currentCacheValidity != null ) {
  @@ -190,9 +192,10 @@
               try {
                   temp = sourceResolver.resolveURI(src);
                   currentCacheValidity.add(src, temp.getLastModified());
  -                getLogger().debug("currentCacheValidity: " + currentCacheValidity);
  +                if (this.getLogger().isDebugEnabled()) {
  +                    getLogger().debug("currentCacheValidity: " + currentCacheValidity);
  +                }
               } catch (Exception e) {
  -                getLogger().error("CachingCIncludeTransformer could not resolve resource:"
+ src,  e);
                   throw new SAXException("CachingCIncludeTransformer could not resolve resource",
e);
               } finally {
                   sourceResolver.release(temp);
  @@ -215,7 +218,6 @@
               source = this.sourceResolver.resolveURI(src);
               this.sourceResolver.toSAX(source, getConsumer());
           } catch (Exception e) {
  -            getLogger().error("CachingCIncludeTransformer", e);
               throw new SAXException("CachingCIncludeTransformer could not read resource",
e);
           } finally {
               sourceResolver.release(source);
  @@ -254,12 +256,11 @@
   
       public CacheValidity generateValidity() {
   
  -        getLogger().debug("generateValidity");
           try {
               currentCacheValidity = new IncludeCacheValidity(sourceResolver);
               return currentCacheValidity;
           } catch (RuntimeException e) {
  -            getLogger().error("CachingCIncludeTransformer: could not generateKey", e);
  +            getLogger().warn("CachingCIncludeTransformer: could not generateKey", e);
               return null;
           }
       }
  
  
  
  1.9       +2 -2      xml-cocoon2/src/java/org/apache/cocoon/transformation/LogTransformer.java
  
  Index: LogTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/LogTransformer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- LogTransformer.java	7 Jun 2002 13:15:10 -0000	1.8
  +++ LogTransformer.java	10 Sep 2002 12:15:49 -0000	1.9
  @@ -145,7 +145,7 @@
           try {
               if (this.logfile != null) logfile.close();
           } catch (Exception e) {
  -            this.getLogger().debug("LogTransformer.recycle()", e);
  +            this.getLogger().warn("LogTransformer.recycle()", e);
           }
           this.logfile = null;
       }
  
  
  
  1.8       +12 -6     xml-cocoon2/src/java/org/apache/cocoon/transformation/ReadDOMSessionTransformer.java
  
  Index: ReadDOMSessionTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/ReadDOMSessionTransformer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ReadDOMSessionTransformer.java	22 Feb 2002 07:03:56 -0000	1.7
  +++ ReadDOMSessionTransformer.java	10 Sep 2002 12:15:49 -0000	1.8
  @@ -113,15 +113,17 @@
         Request request = ObjectModelHelper.getRequest(objectModel);
         session = request.getSession(false);
         if (session != null) {
  -        getLogger().debug("ReadSessionTransformer: SessioID="+session.getId());
  -        getLogger().debug("ReadSessionTransformer: Session available, try to read from
it");
           DOMName = parameters.getParameter(ReadDOMSessionTransformer.DOM_NAME,null);
           trigger = parameters.getParameter(ReadDOMSessionTransformer.TRIGGER_ELEMENT,null);
           position = parameters.getParameter(ReadDOMSessionTransformer.POSITION,"in");
  -        getLogger().debug("ReadSessionTransformer: " + ReadDOMSessionTransformer.DOM_NAME
+ "="+
  +        if (this.getLogger().isDebugEnabled()) {
  +            getLogger().debug("ReadSessionTransformer: SessioID="+session.getId());
  +            getLogger().debug("ReadSessionTransformer: Session available, try to read from
it");
  +            getLogger().debug("ReadSessionTransformer: " + ReadDOMSessionTransformer.DOM_NAME
+ "="+
                             DOMName + " " + ReadDOMSessionTransformer.TRIGGER_ELEMENT + "="
+
                             trigger + " " + ReadDOMSessionTransformer.POSITION + "=" +
                             position);
  +        }
         } else  {
           getLogger().error("ReadSessionTransformer: no session object");
         }
  @@ -133,7 +135,9 @@
       throws SAXException {
         //start streaming after certain startelement is encountered
         if (name.equalsIgnoreCase(trigger)) {
  -        getLogger().debug("ReadSessionTransformer: trigger encountered");
  +        if (this.getLogger().isDebugEnabled()) {
  +            getLogger().debug("ReadSessionTransformer: trigger encountered");
  +        }
           if (position.equalsIgnoreCase("before"))  {
             streamDOM();
             super.contentHandler.startElement(uri,name,raw,attributes);
  @@ -169,7 +173,9 @@
                             +" parameter specified");
         }
         if (node!=null)  {
  -        getLogger().debug("ReadSessionTransformer: start streaming");
  +        if (this.getLogger().isDebugEnabled()) {
  +            getLogger().debug("ReadSessionTransformer: start streaming");
  +        }
           EmbeddedXMLPipe pipe = new EmbeddedXMLPipe(super.contentHandler);
           streamer = new DOMStreamer(pipe,super.lexicalHandler);
           streamer.stream(node);
  
  
  
  1.8       +14 -10    xml-cocoon2/src/java/org/apache/cocoon/transformation/LDAPTransformer.java
  
  Index: LDAPTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/LDAPTransformer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- LDAPTransformer.java	19 Jul 2002 13:09:31 -0000	1.7
  +++ LDAPTransformer.java	10 Sep 2002 12:15:49 -0000	1.8
  @@ -300,13 +300,11 @@
           this.contentHandler.startPrefixMapping("", LDAPTransformer.my_uri);
           AttributesImpl attr = new AttributesImpl();
           LDAPQuery query = (LDAPQuery) queries.elementAt(index);
  -    try {
  -        query.execute();
  +        try {
  +            query.execute();
           } catch (NamingException e) {
  -                getLogger().error(e.toString());
               throw new SAXException (e);
           } catch (Exception e) {
  -                getLogger().error(e.toString());
               throw new SAXException (e);
           }
   
  @@ -345,7 +343,7 @@
           switch (current_state) {
               case STATE_INSIDE_EXECUTE_QUERY:
                   executeQuery(current_query_index);
  -        queries.remove(current_query_index);
  +                queries.remove(current_query_index);
                   --current_query_index;
                   if (current_query_index > -1) {
                       current_state = getCurrentQuery().toDo;
  @@ -387,7 +385,7 @@
           switch (current_state) {
               case LDAPTransformer.STATE_INSIDE_EXECUTE_INCREMENT:
                   executeQuery(current_query_index);
  -        queries.remove(current_query_index);
  +                queries.remove(current_query_index);
                   --current_query_index;
                   if (current_query_index > 1) {
                       current_state = getCurrentQuery().toDo;
  @@ -963,7 +961,9 @@
               super.startElement(uri, name, raw, attributes);
               return;
           }
  -        getLogger().debug("RECEIVED START ELEMENT " + name + "(" + uri + ")");
  +        if (this.getLogger().isDebugEnabled()) {
  +            getLogger().debug("RECEIVED START ELEMENT " + name + "(" + uri + ")");
  +        }
   
           if (name.equals(LDAPTransformer.MAGIC_EXECUTE_QUERY)) {
               startExecuteQuery(attributes);
  @@ -1018,7 +1018,9 @@
               super.endElement(uri, name, raw);
               return;
           }
  -        getLogger().debug("RECEIVED END ELEMENT "+ name + "(" + uri + ")");
  +        if (this.getLogger().isDebugEnabled()) {
  +            getLogger().debug("RECEIVED END ELEMENT "+ name + "(" + uri + ")");
  +        }
   
           if (name.equals(LDAPTransformer.MAGIC_EXECUTE_QUERY)) {
               endExecuteQuery();
  @@ -1090,7 +1092,9 @@
               current_state != LDAPTransformer.STATE_INSIDE_SEARCHBASE_ELEMENT) {
               super.characters(ary, start, length);
           }
  -        getLogger().debug("RECEIVED CHARACTERS: " + new String(ary, start, length));
  +        if (this.getLogger().isDebugEnabled()) {
  +            getLogger().debug("RECEIVED CHARACTERS: " + new String(ary, start, length));
  +        }
           current_value.append(ary, start, length);
       }
   
  
  
  
  1.9       +15 -15    xml-cocoon2/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java
  
  Index: CIncludeTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- CIncludeTransformer.java	22 Jul 2002 01:40:47 -0000	1.8
  +++ CIncludeTransformer.java	10 Sep 2002 12:15:49 -0000	1.9
  @@ -170,11 +170,13 @@
           if (ns == null) ns="";
           if (prefix == null) prefix="";
   
  -        getLogger().debug("Processing CInclude element: src=" + src
  +        if (this.getLogger().isDebugEnabled()) {
  +            getLogger().debug("Processing CInclude element: src=" + src
                             + ", element=" + element
                             + ", select=" + select
                             + ", ns=" + ns
                             + ", prefix=" + prefix);
  +        }
   
           IncludeXMLConsumer consumer = new IncludeXMLConsumer(this);
   
  @@ -201,16 +203,18 @@
   
                       InputSource input = SourceUtil.getInputSource(source);
   
  -                        String xpath = select;
  +                    String xpath = select;
  +                    if (this.getLogger().isDebugEnabled()) {
                           getLogger().debug("XPath is "+xpath);
  -                        Document document = parser.parseDocument(input);
  -                        NodeList list = processor.selectNodeList(document,xpath);
  -                        int length = list.getLength();
  -                        for (int i=0; i<length; i++) {
  -                              consumer.includeNode((Node)list.item(i),
  -                                                   (ContentHandler)this,  
  -                                                   (LexicalHandler)this);
  -                        }
  +                    }
  +                    Document document = parser.parseDocument(input);
  +                    NodeList list = processor.selectNodeList(document,xpath);
  +                    int length = list.getLength();
  +                    for (int i=0; i<length; i++) {
  +                          consumer.includeNode((Node)list.item(i),
  +                                               (ContentHandler)this,  
  +                                               (LexicalHandler)this);
  +                    }
               } else {
                     // do nothing, will result in the inclusion of the whole
                     // document
  @@ -220,16 +224,12 @@
   
   
           } catch (IOException e) {
  -            getLogger().error("CIncludeTransformer", e);
               throw new SAXException("CIncludeTransformer could not read resource", e);
           } catch (SourceException se) {
  -            getLogger().error("Could not stream input", se);
               throw new SAXException("Exception in CIncludeTransformer",se);
           } catch (ProcessingException e){
  -            getLogger().error("Could not stream input", e);
               throw new SAXException("Exception in CIncludeTransformer",e);
           } catch(ComponentException e) {
  -            getLogger().error("Error in processXIncludeElement", e);
               throw new SAXException(e);
           } finally {
             this.manager.release(parser);
  
  
  
  1.22      +73 -32    xml-cocoon2/src/java/org/apache/cocoon/transformation/I18nTransformer.java
  
  Index: I18nTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/I18nTransformer.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- I18nTransformer.java	19 Jul 2002 13:09:31 -0000	1.21
  +++ I18nTransformer.java	10 Sep 2002 12:15:49 -0000	1.22
  @@ -699,12 +699,10 @@
               // obtain the base name of the message catalogue
               Configuration child = conf.getChild(I18N_CATALOGUE_NAME);
               catalogueName = child.getValue(null);
  -            debug("Default catalogue name is " + catalogueName);
   
               // obtain the directory location of message catalogues
               child = conf.getChild(I18N_CATALOGUE_LOCATION);
               catalogueLocation = child.getValue(null);
  -            debug("Default catalogue location is " + catalogueLocation);
   
               // check our mandatory parameters
               if (catalogueName == null || catalogueLocation == null)
  @@ -716,15 +714,20 @@
               // obtain default text to use for untranslated messages
               child = conf.getChild(I18N_UNTRANSLATED);
               untranslated = child.getValue(null);
  -            debug("Default untranslated text is '" + untranslated + "'");
   
               // obtain config option, whether to cache messages at startup time
               child = conf.getChild(I18N_CACHE_STARTUP);
               cacheAtStartup = child.getValueAsBoolean(false);
  -            debug((cacheAtStartup ? "will" : "won't") +
  -                   " cache messages during startup, by default"
  -            );
   
  +            if (this.getLogger().isDebugEnabled()) {
  +                debug("Default catalogue name is " + catalogueName);
  +                debug("Default catalogue location is " + catalogueLocation);
  +                debug("Default untranslated text is '" + untranslated + "'");
  +                debug((cacheAtStartup ? "will" : "won't") +
  +                       " cache messages during startup, by default"
  +                );
  +            }
  +            
               // activate resource bundle logging
               factory.enableLogging(getLogger());
           }
  @@ -770,14 +773,17 @@
   
               // Get current locale
               Locale locale = I18nUtils.parseLocale(lc);
  -            debug("using locale " + locale.toString());
   
               // setup everything for the current locale
               dictionary = (XMLResourceBundle) factory.select(
                   localCatName == null ? catalogueName : localCatName,
                   locale
               );
  -            debug( "selected dictionary " + dictionary );
  +            if (this.getLogger().isDebugEnabled()) {
  +                debug("using locale " + locale.toString());
  +                debug( "selected dictionary " + dictionary );
  +            }
  +            
   
               // Initialize instance state variables
   
  @@ -796,7 +802,6 @@
               this.formatter.setLocale(locale);
   
           } catch (Exception e) {
  -            debug("exception generated, leaving unconfigured");
               throw new ProcessingException(e.getMessage(), e);
           }
       }
  @@ -828,7 +833,9 @@
                   "location"
               );
   
  -        debug("catalog location:" + location);
  +        if (this.getLogger().isDebugEnabled()) {
  +            debug("catalog location:" + location);
  +        }
           Source source = null;
           try {
               source = resolver.resolveURI(location);
  @@ -838,7 +845,9 @@
                       systemId + " does not denote a directory"
                   );
               }
  -            debug("catalog directory:" + systemId);
  +            if (this.getLogger().isDebugEnabled()) {
  +                debug("catalog directory:" + systemId);
  +            }
               dirConf.setValue(systemId);
               configuration.addChild(dirConf);
           } finally {
  @@ -847,7 +856,9 @@
   
           // Pass created configuration object to the factory
           factory.configure(configuration);
  -        debug("configured");
  +        if (this.getLogger().isDebugEnabled()) {
  +            debug("configured");
  +        }
       }
   
       public void compose(ComponentManager manager) {
  @@ -863,7 +874,9 @@
                                Attributes attr) throws SAXException {
   
           if (I18N_NAMESPACE_URI.equals(uri)) {
  -            debug("Starting i18n element: " + name);
  +            if (this.getLogger().isDebugEnabled()) {
  +                debug("Starting i18n element: " + name);
  +            }
               if (strBuffer != null) {
                   i18nCharacters(strBuffer.toString());
                   strBuffer = null;
  @@ -914,7 +927,9 @@
       private void startI18NElement(String name, Attributes attr)
           throws SAXException {
   
  -        debug("Start i18n element: " + name);
  +        if (this.getLogger().isDebugEnabled()) {
  +            debug("Start i18n element: " + name);
  +        }
   
           if (I18N_TEXT_ELEMENT.equals(name)) {
               if (current_state != STATE_OUTSIDE
  @@ -1043,7 +1058,9 @@
       }
   
       private void endI18NElement(String name) throws SAXException {
  -        debug("End i18n element: " + name);
  +        if (this.getLogger().isDebugEnabled()) {
  +            debug("End i18n element: " + name);
  +        }
           switch (current_state) {
           case STATE_INSIDE_TEXT:
               endTextElement();
  @@ -1077,7 +1094,9 @@
               return;
           }
   
  -        debug( "i18n message text = '" + textValue + "'" );
  +        if (this.getLogger().isDebugEnabled()) {
  +            debug( "i18n message text = '" + textValue + "'" );
  +        }
   
           switch (current_state) {
           case STATE_INSIDE_TEXT:
  @@ -1181,7 +1200,9 @@
       }
   
       private void endTextElement() throws SAXException {
  -        debug("End text element, translated_text: " + translated_text);
  +        if (this.getLogger().isDebugEnabled()) {
  +            debug("End text element, translated_text: " + translated_text);
  +        }
           switch (prev_state) {
           case STATE_OUTSIDE:
               // simply translate text (key translation already performed)
  @@ -1190,7 +1211,7 @@
                                                   0, translated_text.length());
               } else {
                   // else - translation not found
  -                debug( "--- Translation not found! ---" );
  +                this.getLogger().warn( "--- Translation not found! ---" );
               }
               break;
   
  @@ -1210,31 +1231,43 @@
   
       // Process substitution parameter
       private void endParamElement() throws SAXException {
  -        debug("Substitution param: " + param_value);
  +        if (this.getLogger().isDebugEnabled()) {
  +            debug("Substitution param: " + param_value);
  +        }
   
           String paramType = (String)formattingParams.get(I18N_TYPE_ATTRIBUTE);
           if (paramType != null) {
               // We have a typed parameter
   
  -            debug("Param type: " + paramType);
  +            if (this.getLogger().isDebugEnabled()) {
  +                debug("Param type: " + paramType);
  +            }
               if (formattingParams.get(I18N_VALUE_ATTRIBUTE) == null &&
                   param_value != null) {
   
  -                debug("Put param value: " + param_value);
  +                if (this.getLogger().isDebugEnabled()) {
  +                     debug("Put param value: " + param_value);
  +                }
                   formattingParams.put(I18N_VALUE_ATTRIBUTE, param_value);
               }
   
               // Check if we have a date or a number parameter
               if (dateTypes.contains(paramType)) {
  -                debug("Formatting date_time param: " + formattingParams);
  +                if (this.getLogger().isDebugEnabled()) {
  +                    debug("Formatting date_time param: " + formattingParams);
  +                }
                   param_value = formatDate_Time(formattingParams);
               } else if (numberTypes.contains(paramType)) {
  -                debug("Formatting number param: " + formattingParams);
  +                if (this.getLogger().isDebugEnabled()) {
  +                    debug("Formatting number param: " + formattingParams);
  +                }
                   param_value = formatNumber(formattingParams);
               }
           }
   
  -        debug("Added substitution param: " + param_value);
  +        if (this.getLogger().isDebugEnabled()) {
  +            debug("Added substitution param: " + param_value);
  +        }
           indexedParams.add(param_value);
           param_value = null;
           current_state = STATE_INSIDE_TRANSLATE;
  @@ -1247,9 +1280,13 @@
   
           String result;
           if (indexedParams.size() > 0 && substitute_text.length() > 0) {
  -            debug("Text for susbtitution: " + substitute_text);
  +            if (this.getLogger().isDebugEnabled()) {
  +                debug("Text for susbtitution: " + substitute_text);
  +            }
               result = formatter.format(substitute_text, indexedParams.toArray());
  -            debug("Result of susbtitution: " + result);
  +            if (this.getLogger().isDebugEnabled()) {
  +                debug("Result of susbtitution: " + result);
  +            }
           } else {
               result = substitute_text;
           }
  @@ -1384,8 +1421,10 @@
           }
   
           // we have all necessary data here: do formatting.
  -        debug("### Formatting date: " + dateValue + " with localized pattern "
  -            + to_fmt.toLocalizedPattern() + " for locale: " + locale);
  +        if (this.getLogger().isDebugEnabled()) {
  +            debug("### Formatting date: " + dateValue + " with localized pattern "
  +                + to_fmt.toLocalizedPattern() + " for locale: " + locale);
  +        }
           return to_fmt.format(dateValue);
       }
   
  @@ -1485,7 +1524,7 @@
               to_fmt = (DecimalFormat)NumberFormat.getPercentInstance(loc);
           } else {
               throw new SAXException("&lt;i18n:number>: unknown type: " + type);
  -    }
  +        }
   
   
           if(fractionDigits > -1) {
  @@ -1520,7 +1559,9 @@
           // we have all necessary data here: do formatting.
           String result = to_fmt.format(numberValue);
           if (appendDec) result = result + dec;
  -        debug("i18n:number result: " + result);
  +        if (this.getLogger().isDebugEnabled()) {
  +            debug("i18n:number result: " + result);
  +        }
           return result;
       }
   
  @@ -1540,7 +1581,7 @@
   
               return value != null ? value : defaultValue;
           } catch (MissingResourceException e)  {
  -	    debug("Untraslated key: '"+key+"'");
  +  	        this.getLogger().warn("Untranslated key: '"+key+"'");
               return defaultValue;
           }
       }
  
  
  
  1.11      +2 -6      xml-cocoon2/src/java/org/apache/cocoon/reading/DatabaseReader.java
  
  Index: DatabaseReader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/reading/DatabaseReader.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DatabaseReader.java	9 Sep 2002 13:25:40 -0000	1.10
  +++ DatabaseReader.java	10 Sep 2002 12:15:49 -0000	1.11
  @@ -149,8 +149,6 @@
   
               this.doCommit = true;
           } catch (Exception e) {
  -            getLogger().warn("Could not get resource from Database", e);
  -
               this.doCommit = false;
   
               throw new ResourceNotFoundException("DatabaseReader error:", e);
  @@ -190,12 +188,10 @@
               Response response = ObjectModelHelper.getResponse(objectModel);
               this.serialize(response);
           } catch (IOException ioe) {
  -            getLogger().debug("Assuming client reset stream");
  +            getLogger().warn("Assuming client reset stream");
   
               this.doCommit = false;
           } catch (Exception e) {
  -            getLogger().warn("Could not get resource from Database", e);
  -
               this.doCommit = false;
   
               throw new ResourceNotFoundException("DatabaseReader error:", e);
  
  
  
  1.19      +1 -2      xml-cocoon2/src/java/org/apache/cocoon/reading/ResourceReader.java
  
  Index: ResourceReader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/reading/ResourceReader.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ResourceReader.java	27 Jun 2002 12:28:51 -0000	1.18
  +++ ResourceReader.java	10 Sep 2002 12:15:49 -0000	1.19
  @@ -109,7 +109,6 @@
           try {
               this.inputSource = resolver.resolveURI(src);
           } catch (SourceException se) {
  -            getLogger().error("Error during resolving of '" + src + "'.", se);
               throw SourceUtil.handle("Error during resolving of '" + src + "'.", se);
           }
       }
  
  
  
  1.8       +4 -6      xml-cocoon2/src/java/org/apache/cocoon/reading/JSPReader.java
  
  Index: JSPReader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/reading/JSPReader.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JSPReader.java	9 Sep 2002 13:25:40 -0000	1.7
  +++ JSPReader.java	10 Sep 2002 12:15:49 -0000	1.8
  @@ -124,7 +124,9 @@
   
               engine = (JSPEngine)this.manager.lookup(JSPEngine.ROLE);
   
  -            getLogger().debug("JSPReader executing JSP:" + url);
  +            if (this.getLogger().isDebugEnabled()) {
  +                this.getLogger().debug("JSPReader executing JSP:" + url);
  +            }
   
               byte[] bytes = engine.executeJSP(url, httpRequest, httpResponse, httpContext);
               // FIXME (KP): Make buffer size configurable
  @@ -140,16 +142,12 @@
               out.flush();
               //
           } catch (ServletException e) {
  -            getLogger().debug("ServletException in JSPReader.generate()", e);
  -            getLogger().debug("Embedded ServletException JSPReader.generate()", e.getRootCause());
               throw new ProcessingException("ServletException in JSPReader.generate()",e.getRootCause());
           } catch (IOException e) {
  -            getLogger().debug("IOException in JSPReader.generate()", e);
               throw new ProcessingException("IOException JSPReader.generate()",e);
           } catch (ProcessingException e) {
               throw e;
           } catch (Exception e) {
  -            getLogger().debug("Exception in JSPReader.generate()", e);
               throw new ProcessingException("Exception JSPReader.generate()",e);
           } finally {
               if (engine != null) this.manager.release(engine);
  
  
  

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