Left side (xx) of 'y' operation has null value. Operation not possible
来源:互联网 发布:图片素材 知乎 编辑:程序博客网 时间:2024/05/17 08:05
Left side (xx) of 'y' operation has null value. Operation not possible
I have been seeing a lot of messages like this in my dotCMS logs:
This results from code such as:
I thought this was strange because the macro this code belonged to wasn't even being executed - so the variable never gets a value anyway. It turns out the fix is to quote the variable, as per below.
That's fine for string values, but won't stop an error on anything involved in a numerical operation.
The above code results in this error:
The fix is to make sure it is a number under any circumstances.
It seems Velocity is a bit like bash or DOS shell scripts in this respect; unless you quote a variable name, it will see null as the value and output an error.
My dotCMS notes.
1
2
[18/10/10 02:19:45:045 EST] ERROR app.VelocityEngine: Left side ($queryType) of '==' operation has null value. Operation not possible. /usr/local/dotcms/webap
ps/../dotCMS/assets/1/4/14777.vtl [line 5, column 25]
This results from code such as:
1
#if ($queryType == "$expectedValue" )
I thought this was strange because the macro this code belonged to wasn't even being executed - so the variable never gets a value anyway. It turns out the fix is to quote the variable, as per below.
1
#if ("$queryType" == "$expectedValue" )
That's fine for string values, but won't stop an error on anything involved in a numerical operation.
1
#if ($totalResults > 0 )
The above code results in this error:
1
2
[18/10/10 02:46:43:043 EST] ERROR app.VelocityEngine: Left side ($totalResults) of '>' operation has null value. Operation not possible. /usr/local/dotcms/webap
ps/../dotCMS/assets/1/4/14777.vtl [line 1, column 24]
The fix is to make sure it is a number under any circumstances.
1
2
3
4
#if (!$UtilMethods.isSet($totalResults))
#set($totalResults = 0)
#end
#if ($totalResults > 0 )
It seems Velocity is a bit like bash or DOS shell scripts in this respect; unless you quote a variable name, it will see null as the value and output an error.
My dotCMS notes.
http://robertmarkbramprogrammer.blogspot.com/2010/10/left-side-xx-of-y-operation-has-null.html
- Left side (xx) of 'y' operation has null value. Operation not possible
- Operation not possible due to RF-kill
- operation not possible due to RF-kill
- previous operation has not finished
- previous operation has not finished
- previous operation has not finished
- previous operation has not finished
- previous operation has not finished
- previous operation has not finished
- ncaught ReferenceError: Invalid left-hand side expression in prefix operation
- Uncaught ReferenceError: Invalid left-hand side expression in postfix operation
- Linux WiFi: operation not possible due to RF-kill
- SIOCSIFFLAGS: Operation not possible due to RF-kill
- SIOCSIFFLAGS: Operation not possible due to RF-kill
- svn Previous operation has not finished
- svn previous operation has not finished
- TMS320F28335: Possible Incorrect Operation of XINTF Module After Power Up
- Uncaught ReferenceError: Invalid left-hand side expression in postfix operation(…)
- 如何让 Qt 的程序使用 Sleep
- CFM 学习总结
- 【转】ASP.NET ViewState详解
- Y1731学习总结
- 【java】java下使用matlab代码
- Left side (xx) of 'y' operation has null value. Operation not possible
- Null value was assigned to a property of primitive type setter of
- netstat+-anb+确认windows的端口使用状况以及关闭80端口
- EFM OAM学习报告
- 数据库中的空字符串和null
- js日期格式判斷(2011/01/30)+-方法+小時分秒格式判斷(HH:MM)
- C/C++变量在内存中的分布
- 我们仍然爱着它们:CS、红警、星际、大富翁…
- signal函数说明