cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/generation DirectoryGenerator.java HTMLGenerator.java ImageDirectoryGenerator.java ScriptGenerator.java ServerPagesGenerator.java
Date Sat, 11 Aug 2001 19:01:07 GMT
vgritsenko    01/08/11 12:01:07

  Modified:    src/org/apache/cocoon/generation DirectoryGenerator.java
                        HTMLGenerator.java ImageDirectoryGenerator.java
                        ScriptGenerator.java ServerPagesGenerator.java
  Log:
  exception handling changes, formatting.
  
  Revision  Changes    Path
  1.8       +15 -19    xml-cocoon2/src/org/apache/cocoon/generation/DirectoryGenerator.java
  
  Index: DirectoryGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/DirectoryGenerator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DirectoryGenerator.java	2001/07/07 11:43:29	1.7
  +++ DirectoryGenerator.java	2001/08/11 19:01:07	1.8
  @@ -62,7 +62,7 @@
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:conny@smb-tec.com">Conny Krappatsch</a>
    *         (SMB GmbH) for Virbus AG
  - * @version CVS $Revision: 1.7 $ $Date: 2001/07/07 11:43:29 $ */
  + * @version CVS $Revision: 1.8 $ $Date: 2001/08/11 19:01:07 $ */
   
   public class DirectoryGenerator extends ComposerGenerator implements Recyclable {
   
  @@ -174,37 +174,33 @@
       public void generate()
       throws SAXException, ProcessingException {
           try {
  -
               Source inputSource;
  -        File path;
  +            File path;
   
               inputSource =  this.resolver.resolve(super.source);
               if (inputSource.isFile() == false) {
  -                throw new IOException("Cannot read directory from "
  -                      + inputSource.getSystemId() + "\"");
  -        }
  +                throw new ResourceNotFoundException(inputSource.getSystemId()
  +                      + " is not a directory.");
  +            }
               path = inputSource.getFile();
  -        if (!path.isDirectory()) {
  -                throw new IOException("Cannot read directory from "
  -                      + inputSource.getSystemId() + "\"");
  -        }
  +            if (!path.isDirectory()) {
  +                throw new ResourceNotFoundException(inputSource.getSystemId()
  +                      + " is not a directory.");
  +            }
   
  +            this.contentHandler.startDocument();
  +            this.contentHandler.startPrefixMapping(PREFIX,URI);
   
  -        this.contentHandler.startDocument();
  -        this.contentHandler.startPrefixMapping(PREFIX,URI);
  +            Stack ancestors = getAncestors(path);
  +            addPathWithAncestors(path, ancestors);
   
  -        Stack ancestors = getAncestors(path);
  -        addPathWithAncestors(path, ancestors);
  -
  -        this.contentHandler.endPrefixMapping(PREFIX);
  -        this.contentHandler.endDocument();
  +            this.contentHandler.endPrefixMapping(PREFIX);
  +            this.contentHandler.endDocument();
           } catch (IOException ioe) {
               getLogger().warn("Could not get resource", ioe);
               throw new ResourceNotFoundException("Could not get directory", ioe);
           }
  -
       }
  -
   
       /**
        * Creates a stack containing the ancestors of File up to specified
  
  
  
  1.9       +4 -3      xml-cocoon2/src/org/apache/cocoon/generation/HTMLGenerator.java
  
  Index: HTMLGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/HTMLGenerator.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- HTMLGenerator.java	2001/08/05 16:40:31	1.8
  +++ HTMLGenerator.java	2001/08/11 19:01:07	1.9
  @@ -45,7 +45,7 @@
   /**
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.8 $ $Date: 2001/08/05 16:40:31 $
  + * @version CVS $Revision: 1.9 $ $Date: 2001/08/11 19:01:07 $
    */
   public class HTMLGenerator extends ComposerGenerator implements Cacheable, Recyclable {
   
  @@ -143,10 +143,11 @@
               }
           } catch (IOException e){
               getLogger().warn("HTMLGenerator.generate()", e);
  -            throw new ResourceNotFoundException("Could not get Resource for HTMLGenerator",
e);
  +            throw new ResourceNotFoundException("Could not get resource "
  +                + this.inputSource.getSystemId(), e);
           } catch (SAXException e){
               getLogger().error("HTMLGenerator.generate()", e);
  -            throw(e);
  +            throw e;
           } catch (ProcessingException e){
               throw e;
           } catch (Exception e){
  
  
  
  1.7       +4 -3      xml-cocoon2/src/org/apache/cocoon/generation/ImageDirectoryGenerator.java
  
  Index: ImageDirectoryGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/ImageDirectoryGenerator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ImageDirectoryGenerator.java	2001/07/23 13:02:13	1.6
  +++ ImageDirectoryGenerator.java	2001/08/11 19:01:07	1.7
  @@ -26,7 +26,7 @@
    * files.
    *
    * @author <a href="mailto:balld@webslingerZ.com">Donald A. Ball Jr.</a>
  - * @version $Revision: 1.6 $ $Date: 2001/07/23 13:02:13 $
  + * @version $Revision: 1.7 $ $Date: 2001/08/11 19:01:07 $
    */
   public class ImageDirectoryGenerator extends DirectoryGenerator {
   
  @@ -48,8 +48,9 @@
               getLogger().debug("getSize(path) = " + dim);
               attributes.addAttribute("",IMAGE_WIDTH_ATTR_NAME,IMAGE_WIDTH_ATTR_NAME,"CDATA",""+dim[0]);
               attributes.addAttribute("",IMAGE_HEIGHT_ATTR_NAME,IMAGE_HEIGHT_ATTR_NAME,"CDATA",""+dim[1]);
  -        } catch (RuntimeException e) {getLogger().debug("ImageDirectoryGenerator.setNodeAttributes",
e);}
  -        catch (Exception e) {
  +        } catch (RuntimeException e) {
  +            getLogger().debug("ImageDirectoryGenerator.setNodeAttributes", e);
  +        } catch (Exception e) {
               getLogger().error("ImageDirectoryGenerator.setNodeAttributes", e);
               throw new SAXException(e);
           }
  
  
  
  1.9       +4 -3      xml-cocoon2/src/org/apache/cocoon/generation/ScriptGenerator.java
  
  Index: ScriptGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/ScriptGenerator.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ScriptGenerator.java	2001/07/07 11:43:30	1.8
  +++ ScriptGenerator.java	2001/08/11 19:01:07	1.9
  @@ -21,6 +21,7 @@
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.excalibur.pool.Recyclable;
   import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.ResourceNotFoundException;
   import org.apache.cocoon.components.parser.Parser;
   import org.apache.cocoon.environment.Source;
   import org.apache.cocoon.environment.SourceResolver;
  @@ -47,7 +48,7 @@
    * </pre>
    *
    * @author <a href="mailto:jafoster@engmail.uwaterloo.ca">Jason Foster</a>
  - * @version CVS $Revision: 1.8 $ $Date: 2001/07/07 11:43:30 $
  + * @version CVS $Revision: 1.9 $ $Date: 2001/08/11 19:01:07 $
    */
   public class ScriptGenerator extends ComposerGenerator implements Configurable,
   Recyclable {
  @@ -166,8 +167,8 @@
               parser.setConsumer(this.xmlConsumer);
               parser.parse(xmlInput);
           } catch (FileNotFoundException e) {
  -            throw new ProcessingException(
  -                    "Exception in ScriptGenerator.generate()", e);
  +            throw new ResourceNotFoundException(
  +                "Could not load script " + this.inputSource.getSystemId(), e);
           } catch (BSFException e) {
               throw new ProcessingException(
                       "Exception in ScriptGenerator.generate()", e);
  
  
  
  1.13      +8 -8      xml-cocoon2/src/org/apache/cocoon/generation/ServerPagesGenerator.java
  
  Index: ServerPagesGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/ServerPagesGenerator.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ServerPagesGenerator.java	2001/07/24 00:35:23	1.12
  +++ ServerPagesGenerator.java	2001/08/11 19:01:07	1.13
  @@ -47,7 +47,7 @@
    * delegating actual SAX event generation.
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.12 $ $Date: 2001/07/24 00:35:23 $
  + * @version CVS $Revision: 1.13 $ $Date: 2001/08/11 19:01:07 $
    */
   public class ServerPagesGenerator
     extends ServletGenerator
  @@ -149,16 +149,16 @@
       }
   
       try {
  -      generator = (XSPGenerator)
  -        programGenerator.load(this.manager, super.source, this.markupLanguage, this.programmingLanguage,
this.resolver);
  +        generator = (XSPGenerator)
  +            programGenerator.load(this.manager, super.source, this.markupLanguage, this.programmingLanguage,
this.resolver);
       } catch (ProcessingException e) {
  -      throw e;
  +        throw e;
       } catch (Exception e) {
  -      getLogger().warn("ServerPagesGenerator.generate()", e);
  -      throw new ResourceNotFoundException(e.getMessage(), e);
  +        getLogger().warn("ServerPagesGenerator.generate()", e);
  +        throw new ResourceNotFoundException(e.getMessage(), e);
       } catch (NoClassDefFoundError e) {
  -      getLogger().warn("Failed to load class: " + e);
  -      throw new ResourceNotFoundException(e.getMessage());
  +        getLogger().warn("Failed to load class: " + e);
  +        throw new ResourceNotFoundException(e.getMessage());
       }
       generator.setup(this.resolver, this.objectModel, super.source, this.parameters);
     }
  
  
  

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