You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Radu Cotescu (Jira)" <ji...@apache.org> on 2020/08/25 14:06:00 UTC

[jira] [Assigned] (SLING-9314) HTL null pointer in ObjectModel.toBoolean(Object) when object.toString() returns null

     [ https://issues.apache.org/jira/browse/SLING-9314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Radu Cotescu reassigned SLING-9314:
-----------------------------------

    Assignee: Radu Cotescu

> HTL null pointer in ObjectModel.toBoolean(Object) when object.toString() returns null
> -------------------------------------------------------------------------------------
>
>                 Key: SLING-9314
>                 URL: https://issues.apache.org/jira/browse/SLING-9314
>             Project: Sling
>          Issue Type: Bug
>          Components: Scripting
>    Affects Versions: Scripting HTL Runtime 1.0.0-1.4.0, Scripting HTL Runtime 1.1.0-1.4.0, Scripting HTL Runtime 1.1.2-1.4.0
>            Reporter: Paul Bjorkstrand
>            Assignee: Radu Cotescu
>            Priority: Major
>
> Though it is bad practice, it is possible that an object can return null from its toString() method. ObjectModel.toBoolean(Object) \[[Line 161|https://github.com/apache/sling-org-apache-sling-scripting-sightly-runtime/blob/master/src/main/java/org/apache/sling/scripting/sightly/render/ObjectModel.java#L161]\] calls .trim() on a potentially null object.
> This causes a difficult to troubleshoot, deeply nested, and cryptic exception to be raised. If object.toString() returns null, then it should be treated the same as nearly the rest of HTL, where null is considered "falsey". Doing so will save hours of difficult troubleshooting.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)