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/java/org/apache/cocoon/generation ScriptGenerator.java ServerPagesGenerator.java VelocityGenerator.java
Date Fri, 25 Jan 2002 03:48:30 GMT
vgritsenko    02/01/24 19:48:30

  Modified:    src/java/org/apache/cocoon/generation ScriptGenerator.java
                        ServerPagesGenerator.java VelocityGenerator.java
  Log:
  code formatting
  
  Revision  Changes    Path
  1.3       +1 -4      xml-cocoon2/src/java/org/apache/cocoon/generation/ScriptGenerator.java
  
  Index: ScriptGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/ScriptGenerator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ScriptGenerator.java	3 Jan 2002 14:56:56 -0000	1.2
  +++ ScriptGenerator.java	25 Jan 2002 03:48:30 -0000	1.3
  @@ -45,7 +45,7 @@
    * </pre>
    *
    * @author <a href="mailto:jafoster@engmail.uwaterloo.ca">Jason Foster</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2002/01/03 14:56:56 $
  + * @version CVS $Revision: 1.3 $ $Date: 2002/01/25 03:48:30 $
    */
   public class ScriptGenerator extends ComposerGenerator implements Configurable,
   Recyclable {
  @@ -111,7 +111,6 @@
           Parser parser = null;
           try {
               // Figure out what file to open and do so
  -
               getLogger().debug("processing file [" + super.source + "]");
               this.inputSource = this.resolver.resolve(super.source);
   
  @@ -119,11 +118,9 @@
   
               // TODO: why doesn't this work?
               // Reader in = src.getCharacterStream();
  -
               Reader in = new java.io.InputStreamReader(this.inputSource.getInputStream());
   
               // Set up the BSF manager and register relevant helper "beans"
  -
               BSFManager mgr = new BSFManager();
   
               // add support for additional languages
  
  
  
  1.3       +6 -4      xml-cocoon2/src/java/org/apache/cocoon/generation/ServerPagesGenerator.java
  
  Index: ServerPagesGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/ServerPagesGenerator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServerPagesGenerator.java	4 Jan 2002 13:24:09 -0000	1.2
  +++ ServerPagesGenerator.java	25 Jan 2002 03:48:30 -0000	1.3
  @@ -59,7 +59,7 @@
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2002/01/04 13:24:09 $
  + * @version CVS $Revision: 1.3 $ $Date: 2002/01/25 03:48:30 $
    */
   public class ServerPagesGenerator extends ServletGenerator
     implements Recyclable, Disposable, Cacheable, Configurable
  @@ -255,15 +255,17 @@
        */
       public void recycle() {
           super.recycle();
  -        if (generator != null)
  -            programGenerator.release(generator);
  -        this.generator = null;
  +        if (this.generator != null) {
  +            programGenerator.release(this.generator);
  +            this.generator = null;
  +        }
           if (this.inputSource != null) {
               this.inputSource.recycle();
               this.inputSource = null;
           }
           if (this.completionPipe != null) {
               this.completionPipe.recycle();
  +            this.completionPipe = null;
           }
       }
   
  
  
  
  1.2       +28 -58    xml-cocoon2/src/java/org/apache/cocoon/generation/VelocityGenerator.java
  
  Index: VelocityGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/VelocityGenerator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- VelocityGenerator.java	3 Jan 2002 12:31:16 -0000	1.1
  +++ VelocityGenerator.java	25 Jan 2002 03:48:30 -0000	1.2
  @@ -125,7 +125,7 @@
    *
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:mike@hihat.net">Michael McKibben</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2002/01/03 12:31:16 $
  + * @version CVS $Revision: 1.2 $ $Date: 2002/01/25 03:48:30 $
    */
   public class VelocityGenerator extends ComposerGenerator 
       implements Initializable, Configurable, Recyclable, LogSystem 
  @@ -228,31 +228,22 @@
            * @param systemId the path to the resource
            */
           private Source resolveSource(String systemId) throws org.apache.velocity.exception.ResourceNotFoundException

  -	{
  +        {
               Map sourceCache;
  -            try 
  -	    {
  +            try {
                   sourceCache = (Map)this.resolverContext.get(CONTEXT_SOURCE_CACHE_KEY);
  -            } 
  -	    catch (ContextException ignore) 
  -	    {
  +            } catch (ContextException ignore) {
                   throw new org.apache.velocity.exception.ResourceNotFoundException("Runtime
Cocoon source cache not specified in resource loader resolver context.");
               }
   
               Source source = (Source)sourceCache.get(systemId);
  -            if (source == null) 
  -	    {
  -                try 
  -		{
  +            if (source == null) {
  +                try {
                       SourceResolver resolver = (SourceResolver)this.resolverContext.get(CONTEXT_RESOLVER_KEY);
                       source = resolver.resolve(systemId);
  -                } 
  -		catch (ContextException ex) 
  -		{
  +                } catch (ContextException ex) {
                       throw new org.apache.velocity.exception.ResourceNotFoundException("No
Cocoon source resolver associated with current request.");
  -                } 
  -		catch (Exception ex) 
  -		{
  +                } catch (Exception ex) {
                       throw new org.apache.velocity.exception.ResourceNotFoundException("Unable
to resolve source: " + ex);
                   }
               }
  @@ -450,20 +441,16 @@
        */
       public void recycle() 
       {
  -	this.activeFlag = false;
  +        this.activeFlag = false;
   
           // recycle all the Source objects resolved/used by our resource loader
           //
  -        try 
  -	{
  +        try {
               Map sourceCache = (Map)this.resolverContext.get(CONTEXT_SOURCE_CACHE_KEY);
  -            for (Iterator it = sourceCache.values().iterator(); it.hasNext();) 
  -	    {
  +            for (Iterator it = sourceCache.values().iterator(); it.hasNext();) {
                   ((Source)it.next()).recycle();
               }
  -        } 
  -	catch (ContextException ignore) 
  -	{
  +        } catch (ContextException ignore) {
           }
   
           this.velocityContext = null;
  @@ -478,19 +465,15 @@
       public void generate()
       throws IOException, SAXException, ProcessingException 
       {
  -	// Guard against calling generate before setup.
  -	//
  -	if (!activeFlag) 
  -	{
  -	    throw new IllegalStateException("generate called on sitemap component before setup.");
  -	}
  +        // Guard against calling generate before setup.
  +        if (!activeFlag) {
  +            throw new IllegalStateException("generate called on sitemap component before
setup.");
  +        }
   
           Parser parser = null;
  -        try 
  -	{
  -            parser = (Parser)(this.manager.lookup(Parser.ROLE));
  -            if (getLogger().isDebugEnabled()) 
  -	    {
  +        try {
  +            parser = (Parser)this.manager.lookup(Parser.ROLE);
  +            if (getLogger().isDebugEnabled()) {
                   getLogger().debug("Processing File: " + super.source);
               }
   
  @@ -502,37 +485,24 @@
               new InputSource(new StringReader(w.toString()));
               parser.setConsumer(this.xmlConsumer);
               parser.parse(xmlInput);
  -        } 
  -	catch (IOException e) 
  -	{
  +        } catch (IOException e) {
               getLogger().warn("VelocityGenerator.generate()", e);
               throw new ResourceNotFoundException("Could not get Resource for VelocityGenerator",
e);
  -        } 
  -	catch (SAXException e) 
  -	{
  +        } catch (SAXException e) {
               getLogger().error("VelocityGenerator.generate()", e);
               throw e;
  -        } 
  -	catch (ComponentException e) 
  -	{
  +        } catch (ComponentException e) {
               getLogger().error("Could not get parser", e);
               throw new ProcessingException("Exception in VelocityGenerator.generate()",
e);
  -        } 
  -	catch (ProcessingException e) 
  -	{
  +        } catch (ProcessingException e) {
               throw e;
  -        } 
  -	catch (Exception e) 
  -	{
  +        } catch (Exception e) {
               getLogger().error("Could not get parser", e);
               throw new ProcessingException("Exception in VelocityGenerator.generate()",
e);
  -        } 
  -	finally 
  -	{
  -            if (parser != null) 
  -	    {
  -		this.manager.release(parser);
  -	    }
  +        } finally {
  +            if (parser != null) {
  +                this.manager.release(parser);
  +            }
           }
       }
   
  
  
  

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