You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Will Glass-Husain <wg...@gmail.com> on 2009/10/16 18:35:41 UTC

silent references cause strict reference checking to fail

Hi!

With some enthusiasm from my dev team, I just turned strict error
checking on for the first time.   Not surprisingly, our app
immediately had some errors.

I was surprised to find that it was failing even with silent
references.  Does anyone remember if that's intentional?

<input class="signupInput" type="text" id="StxtFirstNames"
name="firstName" value="$!user.firstName"/>

org.apache.velocity.exception.MethodInvocationException: Variable
$user has not been set at layout/slide_login.vm[line 13, column 117]

To me that reduces the usefulness of this feature-- we use silent
references a lot, and it doesn't make sense to me that they would all
cause errors.  I was hoping to do a better job of find errors like
"$user.firstname" where $user wasn't set.  But with $!user.firstName I
now have to go through the site and put an #if in every location I
want to be blank if its undefined.

Can anyone using this feature comment?

Thanks,

WILL

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


Re: silent references cause strict reference checking to fail

Posted by Nathan Bubna <nb...@gmail.com>.
I don't use the feature, but my understanding is that strict reference
mode expects all references used to exist in the context.  The quiet
notation--in strict reference mode--is for null values, not invalid
references.

On Fri, Oct 16, 2009 at 9:35 AM, Will Glass-Husain
<wg...@gmail.com> wrote:
> Hi!
>
> With some enthusiasm from my dev team, I just turned strict error
> checking on for the first time.   Not surprisingly, our app
> immediately had some errors.
>
> I was surprised to find that it was failing even with silent
> references.  Does anyone remember if that's intentional?
>
> <input class="signupInput" type="text" id="StxtFirstNames"
> name="firstName" value="$!user.firstName"/>
>
> org.apache.velocity.exception.MethodInvocationException: Variable
> $user has not been set at layout/slide_login.vm[line 13, column 117]
>
> To me that reduces the usefulness of this feature-- we use silent
> references a lot, and it doesn't make sense to me that they would all
> cause errors.  I was hoping to do a better job of find errors like
> "$user.firstname" where $user wasn't set.  But with $!user.firstName I
> now have to go through the site and put an #if in every location I
> want to be blank if its undefined.
>
> Can anyone using this feature comment?
>
> Thanks,
>
> WILL
>
> ---------------------------------------------------------------------
> 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


Re: silent references cause strict reference checking to fail

Posted by Will Glass-Husain <wg...@gmail.com>.
Only if you set the property "runtime.references.strict" to true.

WILL


On Fri, Oct 16, 2009 at 9:43 AM, jian chen <ch...@gmail.com> wrote:
> We used $!user.firstName type of notation a lot, it has been very
> helpful. Hope this is not broken in the new releases...
>
> Jian
>
> On 10/16/09, Will Glass-Husain <wg...@gmail.com> wrote:
>> Hi!
>>
>> With some enthusiasm from my dev team, I just turned strict error
>> checking on for the first time.   Not surprisingly, our app
>> immediately had some errors.
>>
>> I was surprised to find that it was failing even with silent
>> references.  Does anyone remember if that's intentional?
>>
>> <input class="signupInput" type="text" id="StxtFirstNames"
>> name="firstName" value="$!user.firstName"/>
>>
>> org.apache.velocity.exception.MethodInvocationException: Variable
>> $user has not been set at layout/slide_login.vm[line 13, column 117]
>>
>> To me that reduces the usefulness of this feature-- we use silent
>> references a lot, and it doesn't make sense to me that they would all
>> cause errors.  I was hoping to do a better job of find errors like
>> "$user.firstname" where $user wasn't set.  But with $!user.firstName I
>> now have to go through the site and put an #if in every location I
>> want to be blank if its undefined.
>>
>> Can anyone using this feature comment?
>>
>> Thanks,
>>
>> WILL
>>
>> ---------------------------------------------------------------------
>> 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
>
>

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


Re: silent references cause strict reference checking to fail

Posted by jian chen <ch...@gmail.com>.
We used $!user.firstName type of notation a lot, it has been very
helpful. Hope this is not broken in the new releases...

Jian

On 10/16/09, Will Glass-Husain <wg...@gmail.com> wrote:
> Hi!
>
> With some enthusiasm from my dev team, I just turned strict error
> checking on for the first time.   Not surprisingly, our app
> immediately had some errors.
>
> I was surprised to find that it was failing even with silent
> references.  Does anyone remember if that's intentional?
>
> <input class="signupInput" type="text" id="StxtFirstNames"
> name="firstName" value="$!user.firstName"/>
>
> org.apache.velocity.exception.MethodInvocationException: Variable
> $user has not been set at layout/slide_login.vm[line 13, column 117]
>
> To me that reduces the usefulness of this feature-- we use silent
> references a lot, and it doesn't make sense to me that they would all
> cause errors.  I was hoping to do a better job of find errors like
> "$user.firstname" where $user wasn't set.  But with $!user.firstName I
> now have to go through the site and put an #if in every location I
> want to be blank if its undefined.
>
> Can anyone using this feature comment?
>
> Thanks,
>
> WILL
>
> ---------------------------------------------------------------------
> 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