You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ge...@apache.org on 2003/10/29 12:29:39 UTC

cvs commit: jakarta-velocity/src/java/org/apache/velocity/runtime/directive VMProxyArg.java

geirm       2003/10/29 03:29:39

  Modified:    src/java/org/apache/velocity/runtime/directive
                        VMProxyArg.java
  Log:
  Whoops - you couldn't create a map as an arg to a VM :
  
    #foo( { "a":"b" } )
  
  Revision  Changes    Path
  1.14      +17 -12    jakarta-velocity/src/java/org/apache/velocity/runtime/directive/VMProxyArg.java
  
  Index: VMProxyArg.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/VMProxyArg.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- VMProxyArg.java	4 May 2003 17:18:38 -0000	1.13
  +++ VMProxyArg.java	29 Oct 2003 11:29:39 -0000	1.14
  @@ -287,19 +287,19 @@
                */
   
               Object retObject = null;
  -            
  -            if ( type == ParserTreeConstants.JJTREFERENCE ) 
  -            {                
  +
  +            if ( type == ParserTreeConstants.JJTREFERENCE )
  +            {
                   /*
                    *  two cases :  scalar reference ($foo) or multi-level ($foo.bar....)
                    */
  -                
  +
                   if ( numTreeChildren == 0)
  -                {      
  +                {
                       /*
                        *  if I am a single-level reference, can I not get get it out of my context?
                        */
  -                
  +
                       retObject = context.get( singleLevelRef );
                   }
                   else
  @@ -311,13 +311,17 @@
                       retObject = nodeTree.execute( null, context);
                   }
               }
  +            else if (type == ParserTreeConstants.JJTMAP)
  +            {
  +                retObject = nodeTree.value(context);
  +            }
               else if( type == ParserTreeConstants.JJTOBJECTARRAY )
               {
                   retObject = nodeTree.value( context );
               }
               else if ( type == ParserTreeConstants.JJTINTEGERRANGE)
               {
  -                retObject = nodeTree.value( context );    
  +                retObject = nodeTree.value( context );
               }
               else if( type == ParserTreeConstants.JJTTRUE )
               {
  @@ -340,12 +344,12 @@
                   /*
                    *  this really shouldn't happen.  text is just a thowaway arg for #foreach()
                    */
  -                           
  -                try 
  +
  +                try
                   {
                       StringWriter writer =new StringWriter();
                       nodeTree.render( context, writer );
  -                    
  +
                       retObject = writer;
                   }
                   catch (Exception e )
  @@ -361,7 +365,7 @@
               {
                   rsvc.error("Unsupported VM arg type : VM arg = " + callerReference +" type = " + type + "( VMProxyArg.getObject() )");
               }
  -            
  +
               return retObject;
           }
           catch( MethodInvocationException mie )
  @@ -391,6 +395,7 @@
           case ParserTreeConstants.JJTINTEGERRANGE :
           case ParserTreeConstants.JJTREFERENCE :
           case ParserTreeConstants.JJTOBJECTARRAY :
  +        case ParserTreeConstants.JJTMAP :
           case ParserTreeConstants.JJTSTRINGLITERAL :
           case ParserTreeConstants.JJTTEXT :
               {
  
  
  

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