You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by he...@apache.org on 2004/08/23 01:25:35 UTC

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

henning     2004/08/22 16:25:35

  Modified:    src/java/org/apache/turbine/services/velocity Tag:
                        TURBINE_2_3_BRANCH TurbineVelocityService.java
  Log:
  Fix the brown paper-bag bug that made RC1 unusable for anything that needs
  Velocity or the Pull service
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.27.2.4  +28 -2     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.27.2.3
  retrieving revision 1.27.2.4
  diff -u -r1.27.2.3 -r1.27.2.4
  --- TurbineVelocityService.java	16 Aug 2004 22:57:49 -0000	1.27.2.3
  +++ TurbineVelocityService.java	22 Aug 2004 23:25:35 -0000	1.27.2.4
  @@ -21,8 +21,10 @@
   import java.io.OutputStream;
   import java.io.OutputStreamWriter;
   import java.io.Writer;
  +
   import java.util.Iterator;
   import java.util.List;
  +import java.util.Vector;
   
   import javax.servlet.ServletConfig;
   
  @@ -523,7 +525,30 @@
               if (!key.endsWith(RESOURCE_LOADER_PATH))
               {
                   Object value = conf.getProperty(key);
  -                veloConfig.addProperty(key, value);
  +
  +                // Since 1.0-pre-something, Commons Collections suddently
  +                // no longer returns a vector for multiple value-keys but a
  +                // List object. Velocity will choke if we add this object because
  +                // org.apache.commons.collections.ExtendedProperties expect a
  +                // Vector object. Ah, the joys of incompatible class changes, 
  +                // unwritten assumptions and general Java JAR Hell... =8-O
  +                if (value instanceof List)
  +                {
  +                    List srcValue = (List) value;
  +                    Vector targetValue = new Vector(srcValue.size());
  +
  +                    for (Iterator it = srcValue.iterator(); it.hasNext(); )
  +                    {
  +                        targetValue.add(it.next());
  +                    }
  +
  +                    veloConfig.addProperty(key, targetValue);
  +                }
  +                else
  +                {
  +                    veloConfig.addProperty(key, value);
  +                }
  +
                   continue; // for()
               }
   
  @@ -544,6 +569,7 @@
               // jar:file://path-component!/entry-component
               // file://path-component
               // path/component
  +
               for (Iterator j = paths.iterator(); j.hasNext();)
               {
                   String path = (String) j.next();
  
  
  

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