velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Cohen <sco...@javactivity.org>
Subject Re: Template lose track of variable?
Date Wed, 21 Jan 2009 22:51:31 GMT
Thanks much, Tim, but in this case

1) tn is not null, but tn.USFormattedTn is null (perhaps because some
dependent object failed in the background).

cannot be the case - the function merely applies formatting to the 
single data element within the tn object (in this case the "1-"). Since 
the log entry shows a value for tn, there is no possibility of null here.

2) There are multiple calls to $tn.USFormattedTn, and the happy path
cases work fine, but edge cases are misspelled:

there is only one path in this particular template

3) Someone accidentally calls the .vm directly and not through the
controller (robots can do this in some cases, or bad links).

impossible. There is only one path into the templates from my code. 
there is no "back door"

4) The value of $tn goes null between the controller debug statement and
the forward to the .vm.

I investigated this and found it "impossible" - no code does it anyway, 
although if we are talking about machine glitches, of course, nothing is 
impossible.

So, are we talking about machine glitches, then?

White, Tim wrote:

>> I can see from my logs that the context passed to this template in
>>     
> this 
>   
>> instance had the tn variable and that it wasn't found by Velocity:
>>     
>
>   
>> 2009-01-20 16:58:15,902 [robo/AIM:jrelay/2701] TRACE 
>> velocity.VelociWrapper - {tn=203-999-9999, lang=English}
>> 2009-01-20 16:58:15,910 [robo/AIM:jrelay/2701] DEBUG Velocity - 
>> ResourceManager : found /resources/en_US/number/ExitComplete.vm with 
>> loader org.apache.velocity.tools.view.servlet.WebappLoader
>> 2009-01-20 16:58:15,911 [robo/AIM:jrelay/2701] DEBUG Velocity - Null 
>> reference [template '/resources/en_US/number/ExitComplete.vm', line 6,
>>     
>
>   
>> column 56] : $tn.USFormattedTn cannot be resolved.
>>     
>
>
>
> When I've had problems like these in the past, here are some things that
> it's turned out to be (using your variable as an example):
>
> 1) tn is not null, but tn.USFormattedTn is null (perhaps because some
> dependent object failed in the background).
>
> 2) There are multiple calls to $tn.USFormattedTn, and the happy path
> cases work fine, but edge cases are misspelled:
>
> 	#if ($allisgood)
> 		Your TN is: $tn.USFormattedTn
> 	#else
> 		Your TN is: $tn.usformattedtn
> 	#end
>
> 3) Someone accidentally calls the .vm directly and not through the
> controller (robots can do this in some cases, or bad links).
>
> 4) The value of $tn goes null between the controller debug statement and
> the forward to the .vm.
>
>
> Just some ideas of the kinds of things that this has been for me in the
> past - I hope you can figure it out!
>
> Tim
>
>
>
> This communication is the property of Qwest and may contain confidential or
> privileged information. Unauthorized use of this communication is strictly 
> prohibited and may be unlawful.  If you have received this communication 
> in error, please immediately notify the sender by reply e-mail and destroy 
> all copies of the communication and any attachments.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
>
>   


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


Mime
View raw message