Paul Bjorkstrand created SLING-9314:
---------------------------------------

             Summary: 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.1.2-1.4.0, Scripting HTL Runtime 
1.1.0-1.4.0, Scripting HTL Runtime 1.0.0-1.4.0
            Reporter: Paul Bjorkstrand


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)

Reply via email to