You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ep...@apache.org on 2004/05/07 23:13:39 UTC

cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/services/velocity TurbineVelocityService.java

epugh       2004/05/07 14:13:39

  Modified:    src/java/org/apache/turbine/services/velocity
                        TurbineVelocityService.java
  Log:
  Patch from Peter Courcoux to handle multiple velocity template sources.
  
  Revision  Changes    Path
  1.31      +13 -3     jakarta-turbine-2/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
  
  Index: TurbineVelocityService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- TurbineVelocityService.java	28 Mar 2004 17:36:21 -0000	1.30
  +++ TurbineVelocityService.java	7 May 2004 21:13:39 -0000	1.31
  @@ -59,6 +59,7 @@
   import java.io.OutputStream;
   import java.io.OutputStreamWriter;
   import java.io.Writer;
  +import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.List;
   
  @@ -117,7 +118,7 @@
   {
       /** The generic resource loader path property in velocity.*/
       private static final String RESOURCE_LOADER_PATH = ".resource.loader.path";
  -
  +    
       /** Default character set to use if not specified in the RunData object. */
       private static final String DEFAULT_CHAR_SET = "ISO-8859-1";
   
  @@ -557,7 +558,16 @@
               if (!key.endsWith(RESOURCE_LOADER_PATH))
               {
                   Object value = conf.getProperty(key);
  -                veloConfig.addProperty(key, value);
  +                if (value instanceof ArrayList) {
  +                    for (Iterator itr = ((ArrayList)value).iterator(); itr.hasNext();)
  +                    {
  +                        veloConfig.addProperty(key, itr.next());
  +                    }
  +                } 
  +                else
  +                {
  +                    veloConfig.addProperty(key, value);
  +                }
                   continue; // for()
               }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: cvs commit:

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Peter Courcoux <pe...@courcoux.biz> writes:

Folks,

what's so special with ArrayList that it deserves an

>>   +                if (value instanceof ArrayList) {
>>   +                    for (Iterator itr = ((ArrayList)value).iterator(); itr.hasNext();)
>>   +                    {
>>   +                        veloConfig.addProperty(key, itr.next());
>>   +                    }

IMNSVHO

import java.util.List;

if (value instanceof List)
{
    for(Iterator it = ((List) value).iterator(); it.hasNext(); )
    {
        veloConfig.addProperty(key, it.next());
    }
}

would not only work as good, but would allow users, that prefer other
types of List implementations to use this as well.

Also: space style, bracket style. :-/

Or am I missing something here�

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

"Au�erdem k�nnen in Deutschland alle Englisch. [...] so entf�llt die
Notwendigkeit [...] Deutsch zu lernen." 
            -- Johan Micoud auf die Frage warum er kein Deutsch spricht.
                   (http://www.spiegel.de/spiegel/0,1518,273205,00.html)

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/services/velocity TurbineVelocityService.java

Posted by Peter Courcoux <pe...@courcoux.biz>.
Thanks Eric.

On Fri, 2004-05-07 at 22:13, epugh@apache.org wrote:
> epugh       2004/05/07 14:13:39
> 
>   Modified:    src/java/org/apache/turbine/services/velocity
>                         TurbineVelocityService.java
>   Log:
>   Patch from Peter Courcoux to handle multiple velocity template sources.
>   
>   Revision  Changes    Path
>   1.31      +13 -3     jakarta-turbine-2/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
>   
>   Index: TurbineVelocityService.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java,v
>   retrieving revision 1.30
>   retrieving revision 1.31
>   diff -u -r1.30 -r1.31
>   --- TurbineVelocityService.java	28 Mar 2004 17:36:21 -0000	1.30
>   +++ TurbineVelocityService.java	7 May 2004 21:13:39 -0000	1.31
>   @@ -59,6 +59,7 @@
>    import java.io.OutputStream;
>    import java.io.OutputStreamWriter;
>    import java.io.Writer;
>   +import java.util.ArrayList;
>    import java.util.Iterator;
>    import java.util.List;
>    
>   @@ -117,7 +118,7 @@
>    {
>        /** The generic resource loader path property in velocity.*/
>        private static final String RESOURCE_LOADER_PATH = ".resource.loader.path";
>   -
>   +    
>        /** Default character set to use if not specified in the RunData object. */
>        private static final String DEFAULT_CHAR_SET = "ISO-8859-1";
>    
>   @@ -557,7 +558,16 @@
>                if (!key.endsWith(RESOURCE_LOADER_PATH))
>                {
>                    Object value = conf.getProperty(key);
>   -                veloConfig.addProperty(key, value);
>   +                if (value instanceof ArrayList) {
>   +                    for (Iterator itr = ((ArrayList)value).iterator(); itr.hasNext();)
>   +                    {
>   +                        veloConfig.addProperty(key, itr.next());
>   +                    }
>   +                } 
>   +                else
>   +                {
>   +                    veloConfig.addProperty(key, value);
>   +                }
>                    continue; // for()
>                }
>    
>   
>   
>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org