`
nathan09
  • 浏览: 145047 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

Left side (xx) of 'y' operation has null value. Operation not possible

 
阅读更多

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:
?
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
分享到:
评论

相关推荐

    python源码 missing.py 缺省值

    缺省值pd.isna pd.isnull pd.notna pd.notnull np.nan isnull = isna _isna_new(obj) _isna_old(obj) _isna = _isna_new _use_inf_as_na(key) _isna_ndarraylike(obj) _isna_ndarraylike_old(obj) notna(obj) not...

    mysql not in、left join、IS NULL、NOT EXISTS 效率问题记录

    NOT IN、JOIN、IS NULL、NOT EXISTS效率对比 语句一:select count(*) from A where A.a not in (select a from B) 语句二:select count(*) from A left join B on A.a = B.a where B.a is null 语句三:select ...

    Seperates string to the left of a certain character (ex. com

    Seperates string to the left of a certain character (ex. comma) or to the right and adds them to list boxes!

    C#读取JPEG图片的Exif信息

    // of the data once it is returned. Those properties have their own // methods. switch (exifCode) { case Definitions.exifCode.ImageDescription: returnValue = ParsedString(Definitions.exifCode....

    Javascript中封装window.open解决不兼容问题

    对window.open进行封装, 使其更好用, 且更兼容, 很多人说window.open不兼容,其实不是, 因为不能直接执行, 必须通过用户手动触发才行;...options.left = options.left || ((screen.width - options.widt

    time-progress-bar-src.zip_SIDE BY SIDE_Time_Time Progress Bar_Ti

    I wanted a control that will display more information about the progress of the task - the time passed since the start of the task, the time left to the end of the task and the percent of passed time...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    connector's end point moving, the link is breaks if the move was not on one of the flex-controls connection points. Contain False as default. - ADD Added ControlDocRect parameter in event ...

    2009 达内Unix学习笔记

    集合了 所有的 Unix命令大全 ...telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss ... 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ ... 命令和参数之间必需用空格隔...

    Teach Yourself C in 24 Hours (2nd Edition).pdf

    of pointer on the left side of an assignment operator. (You’ll learn more about the malloc()function later in the book.) Notesare explanations of interesting properties of a particular C program ...

    SQL语句优化——in,not in,exists,not exists, left join...on博客所需SQL语句.txt

    SQL语句优化——in,not in,exists,not exists, left join...on博客所需SQL语句.txt欢迎下载!

    kgb档案压缩console版+源码

    as the digits of x are read, the set of possible y satisfying (1) is restricted to an increasingly narrow lexicographical range containing y. All of the strings in this range will share a growing ...

    微软内部资料-SQL性能优化3

    For an example of how to decode value from this column using the information above, let us assume we have the following value: 0x000705001F83D775010002014F0BEC4E With byte swapping within each ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    They are marked by the triangle icon, which you see here on your left. Click it now. You should see "Hooray" appear below. Hooray! Now you know you can expand points to get more details. ...

    Keil.STM32F2xx_DFP.2.9.0.rar

    Keil.STM32F2xx_DFP.2.9.0.pack

    right_side_left.tar.gz_Upside Down_lena

    upside-down lena.im right-side-left lena.im diagonally mirrored lena.im

    数位板压力测试

    When the user is viewing the device in its normal position, the coordinate origin will be at the lower left of the device. The coordinate system will be right-handed, that is, the positive x axis ...

    C++标准库(第二版)英文版.pdf

    Acknowledgments for the FirstEdition xxvi 1 About This Book 1 1.1 Why This Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Before ReadingThis Book. . . . . . . . . . ...

    SSD7 选择题。Multiple-Choice

    (b) the name of the table, the names of the table's attributes, the data types of the table's attributes, the formats of the table's attributes, and the maximum number of rows that the table can have...

    easyload 9.0

    DB_Y_LL The lower left bounding Y value. –90 DB_X_UR The upper right bounding X value. 360 DB_Y_UR The upper right bounding Y value. 90 COORDINATESYSTEM A string representing a MapInfo CoordSys ...

Global site tag (gtag.js) - Google Analytics