Nathan Bubna wrote:
Are you sure that getUSFormattedTn() is declared public and that
TelephoneNumber is a public class?
Yes.
If so, double check directly that tn is in the context
The log file entry below confirms that.
and is the
expected class by doing $tn.class right before or after the call to
$tn.USFormattedTn.
Not sure what you meant by "doing" $tn.class. Were you talking about a temporary test that displays the class?


If all above checks out, you might as well try $tn.getUSFormattedTn()
just to make sure there isn't some property->method mapping issue.

In any case, I revised the template to read as follows for experimental purposes:

Thank you.  Your phone number is <b>$tn.USFormattedTn</b>
Thank you.  Your phone number is <b>$tn.uSFormattedTn</b>
Thank you.  Your phone number is <b>$tn.getUSFormattedTn()</b>
$tn.class

which produced this output:

Thank you.  Your phone number is 1-888-888-8888
Thank you.  Your phone number is 1-888-888-8888
Thank you.  Your phone number is 1-888-888-8888
class com.foo.bar.data.pojos.TelephoneNumber

In other words, yes, the object passed to the template was of the expected class and no, I wasn't able to reproduce the problem.

If you still can't figure it out, write back confirming the above and
also let us know which version of Velocity you are using.

Hmm, could that be the issue? The production system where the problem occurred is using 1.6.1. The development version (where I can't reproduce the problem) uses 1.6.2. Since we will be using 1.6.2 in production soon, if that is the case, it might solve the problem.

On Mon, Apr 6, 2009 at 7:04 AM, Steve Cohen <sco...@javactivity.org> wrote:
I am making a reference from a template that isn't working and, based on
what I see in my logs, it makes no sense to me.

Here is the template:

Thank you.  Your new phone number is $tn.USFormattedTn

$tn is an object of class TelephoneNumber.
TelephoneNumber has a method String getUSFormattedTn();

The expected output here is
Thank you.  Your new phone number is 1-555-355-5555

Instead user sees
Thank you.  Your new phone number is $tn.USFormattedTn

TelephoneNumber.toString() in returns the string representation without the
preceding "1-" country code, in this case, "555-355-5555"  In the following
log fragments, this is what appears, it is just showing the toString()
output, which shows that tn is not null when passed to the template, it does
not mean that we are passing the string representation to the template..


2009-04-01 15:15:59,750 [robo/191312] INFO  number.NumberModel  - COMPLETE:
number 555-355-5555 has been provisioned.
2009-04-01 15:15:59,750 [robo/191312] DEBUG bot.RelayRobot  - phone order
status: ExitComplete
2009-04-01 15:15:59,750 [robo/191312] TRACE velocity.VelociWrapper  -
{tn=555-355-5555, lang=English}
2009-04-01 15:15:59,751 [robo/191312] DEBUG Velocity  - ResourceManager :
found /resources/en_US/number/ExitComplete.vm with loader
org.apache.velocity.tools.view.servlet.WebappLoader
2009-04-01 15:15:59,753 [robo/191312] DEBUG Velocity  - Null reference
[template '/resources/en_US/number/ExitComplete.vm', line 6, column 56] :
$tn.USFormattedTn cannot be resolved.

I really don't understand what's going on here.  The object is non-null when
passed to the template.  I don't see where the null reference could be
coming from.  There are no obvious threading issues that I can see, either.
 Additionally, I have other templates which use this method reference in the
exact same way, with no issues.

Can someone suggest a path forward to understanding what is going on here?

Thank you.


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



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





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

Reply via email to