How to resolve "org.rythmengine.exception.CompileException: Duplicate parameter e"

50 views
Skip to first unread message

Swati Raina

unread,
May 26, 2015, 8:29:26 PM5/26/15
to rythm...@googlegroups.com
Hi, 
I am new to rythm and cant seem to find enough documentation to read through s posting the Questions here.

My template looks like this:

@args String subTitle
@args String title
@args String description
@args String locale
@args java.util.List<String> pictureURL
@args java.util.Map<String,Object> itemSpecifics
@args String productIds
@args Integer order

{
"localizedProductDetails":[
{
"subTitle":"@subTitle",
"title":"@title",
"description":"@description",
"locale":"@locale",

@if(itemSpecifics != null) {

"attributes":{

@for( Map.Entry<String,Object> e: itemSpecifics.entrySet()){
"@(e.getKey())" : @(e.getValue()) ,
}

}

}
}

],

@if(pictureURL != null){

"pictures":[ {

@for( String pic : pictureURL ){
"order":"@(order+1)",
"pictureURL":"@pic"
}
}
]
,
}


}

and then i pass the hashmap of values to be populated.
But i get compile issue: 
org.rythmengine.exception.CompileException: Duplicate parameter e

Template: Product_Template.txt

Relevant template source lines:
-------------------------------------------------
   18:          @if(itemSpecifics != null) {
   19: 
   20:             "attributes":{
   21: 
   22:                 @for( Map.Entry<String,Object> e: itemSpecifics.entrySet()){
>> 23:                     "@(e.getKey())" : @(e.getValue()) ,
   24:                 }
   25: 
   26:             }
   27: 
   28:          }
   29:       }


Relevant Java source lines:
-------------------------------------------------
   217: org.rythmengine.internal.LoopUtil e_utils = new org.rythmengine.internal.LoopUtil(e_isFirst, e_isLast); //line: 22
   218: org.rythmengine.internal.LoopUtil e__utils = new org.rythmengine.internal.LoopUtil(e_isFirst, e_isLast, e); //line: 22
   219: __pushItrVar("e", e); //line: 22
   220: p(" \""); //line: 23
   221: 
>> 222: try{pe((e.getKey()));} catch (RuntimeException e) {__handleTemplateExecutionException(e);}  //line: 23
   223: p("\" : "); //line: 23
   224: 
   225: try{pe((e.getValue()));} catch (RuntimeException e) {__handleTemplateExecutionException(e);}  //line: 23
   226: p(" ,\n"); //line: 23
   227: 
   228: 	__popItrVar();


Can someone please guide?
Thanks

green

unread,
May 26, 2015, 8:40:22 PM5/26/15
to rythm...@googlegroups.com
Try to avoid use "e" as your variable name, obviously rythm in that version is using it as the name of the RuntimeException. 

--
You received this message because you are subscribed to the Google Groups "rythmengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rythmengine...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Swati Raina

unread,
May 27, 2015, 1:27:03 PM5/27/15
to rythm...@googlegroups.com
Thanks! That was the issue and it got fixed when i refactored the name.
Reply all
Reply to author
Forward
0 new messages