cziegeler 2002/09/06 07:25:45 Modified: src/java/org/apache/cocoon/generation ImageDirectoryGenerator.java DirectoryGenerator.java FileGenerator.java HTMLGenerator.java JspGenerator.java Log: Fixing some classes with respect to exception logging and logging in general Revision Changes Path 1.5 +4 -5 xml-cocoon2/src/java/org/apache/cocoon/generation/ImageDirectoryGenerator.java Index: ImageDirectoryGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/ImageDirectoryGenerator.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ImageDirectoryGenerator.java 22 Feb 2002 07:03:51 -0000 1.4 +++ ImageDirectoryGenerator.java 6 Sep 2002 14:25:45 -0000 1.5 @@ -79,13 +79,14 @@ } try { int dim[] = getSize(path); - getLogger().debug("getSize(path) = " + dim); + if (this.getLogger().isDebugEnabled()) { + this.getLogger().debug("getSize(path) = " + dim); + } attributes.addAttribute("",IMAGE_WIDTH_ATTR_NAME,IMAGE_WIDTH_ATTR_NAME,"CDATA",String.valueOf(dim[0])); attributes.addAttribute("",IMAGE_HEIGHT_ATTR_NAME,IMAGE_HEIGHT_ATTR_NAME,"CDATA",String.valueOf(dim[1])); } catch (RuntimeException e) { getLogger().debug("ImageDirectoryGenerator.setNodeAttributes", e); } catch (Exception e) { - getLogger().error("ImageDirectoryGenerator.setNodeAttributes", e); throw new SAXException(e); } } @@ -97,7 +98,6 @@ if(type.equals("gif")) return getGifSize(file); else return getJpegSize(file); } catch(Exception e) { - Hierarchy.getDefaultHierarchy().getLoggerFor("cocoon").debug("File is not a valid GIF or Jpeg", e); throw new RuntimeException("File is not a valid GIF or Jpeg"); } @@ -149,7 +149,6 @@ } } } catch(Exception e) { - Hierarchy.getDefaultHierarchy().getLoggerFor("cocoon").debug("Not a valid Jpeg file!", e); throw new RuntimeException("Not a valid Jpeg file!"); } 1.11 +12 -9 xml-cocoon2/src/java/org/apache/cocoon/generation/DirectoryGenerator.java Index: DirectoryGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/DirectoryGenerator.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- DirectoryGenerator.java 13 Jun 2002 09:28:16 -0000 1.10 +++ DirectoryGenerator.java 6 Sep 2002 14:25:45 -0000 1.11 @@ -179,28 +179,32 @@ } this.depth = par.getParameterAsInteger("depth", 1); - getLogger().debug("depth: " + this.depth); this.sort = par.getParameter("sort", "name"); - getLogger().debug("sort: " + this.sort); this.reverse = par.getParameterAsBoolean("reverse", false); - getLogger().debug("reverse: " + this.reverse); String rePattern = par.getParameter("root", null); + if (this.getLogger().isDebugEnabled()) { + this.getLogger().debug("depth: " + this.depth); + this.getLogger().debug("sort: " + this.sort); + this.getLogger().debug("reverse: " + this.reverse); + } try { - getLogger().debug("root pattern: " + rePattern); this.rootRE = (rePattern == null)?null:new RE(rePattern); rePattern = par.getParameter("include", null); - getLogger().debug("include pattern: " + rePattern); this.includeRE = (rePattern == null)?null:new RE(rePattern); rePattern = par.getParameter("exclude", null); - getLogger().debug("exclude pattern: " + rePattern); this.excludeRE = (rePattern == null)?null:new RE(rePattern); + + if (this.getLogger().isDebugEnabled()) { + this.getLogger().debug("root pattern: " + rePattern); + this.getLogger().debug("include pattern: " + rePattern); + this.getLogger().debug("exclude pattern: " + rePattern); + } } catch (RESyntaxException rese) { - getLogger().error("Syntax error in regexp pattern '" + rePattern + "'", rese); throw new ProcessingException("Syntax error in regexp pattern '" + rePattern + "'", rese); } @@ -248,7 +252,6 @@ } catch (SourceException se) { throw SourceUtil.handle(se); } catch (IOException ioe) { - getLogger().warn("Could not read directory " + directory, ioe); throw new ResourceNotFoundException("Could not read directory " + directory, ioe); } finally { 1.15 +1 -2 xml-cocoon2/src/java/org/apache/cocoon/generation/FileGenerator.java Index: FileGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/FileGenerator.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- FileGenerator.java 4 Jun 2002 07:54:21 -0000 1.14 +++ FileGenerator.java 6 Sep 2002 14:25:45 -0000 1.15 @@ -141,7 +141,6 @@ } catch (SAXException e) { final Exception cause = e.getException(); if( cause != null ) { - this.getLogger().debug("Got SAXException; Rethrowing cause exception", e); if ( cause instanceof ProcessingException ) throw (ProcessingException)cause; if ( cause instanceof IOException ) 1.19 +4 -10 xml-cocoon2/src/java/org/apache/cocoon/generation/HTMLGenerator.java Index: HTMLGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/HTMLGenerator.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- HTMLGenerator.java 8 Aug 2002 07:28:32 -0000 1.18 +++ HTMLGenerator.java 6 Sep 2002 14:25:45 -0000 1.19 @@ -105,11 +105,7 @@ public void compose(ComponentManager manager) throws ComponentException { super.compose( manager ); - try { - this.processor = (XPathProcessor)this.manager.lookup(XPathProcessor.ROLE); - } catch (Exception e) { - getLogger().error("cannot obtain XPathProcessor", e); - } + this.processor = (XPathProcessor)this.manager.lookup(XPathProcessor.ROLE); } /** @@ -235,21 +231,19 @@ streamer.stream(doc); } } catch (IOException e){ - getLogger().warn("HTMLGenerator.generate()", e); throw new ResourceNotFoundException("Could not get resource " + this.inputSource.getSystemId(), e); } catch (SAXException e){ - getLogger().error("HTMLGenerator.generate()", e); throw e; } catch (Exception e){ - getLogger().error("Could not setup jtidy", e); throw new ProcessingException("Exception in HTMLGenerator.generate()",e); } } public void dispose() { - if ((this.manager != null) && (this.processor instanceof Component)) { + if (this.manager != null) { this.manager.release((Component)this.processor); + this.manager = null; } this.processor = null; super.dispose(); 1.9 +1 -7 xml-cocoon2/src/java/org/apache/cocoon/generation/JspGenerator.java Index: JspGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/JspGenerator.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- JspGenerator.java 13 Jun 2002 09:28:16 -0000 1.8 +++ JspGenerator.java 6 Sep 2002 14:25:45 -0000 1.9 @@ -127,20 +127,14 @@ parser = (Parser)this.manager.lookup(Parser.ROLE); parser.parse(input, this.xmlConsumer); } catch (ServletException e) { - getLogger().debug("ServletException in JspGenerator.generate()", e); - getLogger().debug("Embedded ServletException JspGenerator.generate()", e.getRootCause()); throw new ProcessingException("ServletException in JspGenerator.generate()",e.getRootCause()); } catch (SAXException e) { - getLogger().debug("SAXException JspGenerator.generate()", e); - getLogger().debug("Embedded SAXException JspGenerator.generate()", e.getException()); throw new ProcessingException("SAXException JspGenerator.generate()",e.getException()); } catch (IOException e) { - getLogger().debug("IOException in JspGenerator.generate()", e); throw new ProcessingException("IOException JspGenerator.generate()",e); } catch (ProcessingException e) { throw e; } catch (Exception e) { - getLogger().debug("Exception in JspGenerator.generate()", e); throw new ProcessingException("Exception JspGenerator.generate()",e); } finally { this.manager.release(parser);
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]