How can I solve NullPointerException for Calculated Value applied to Timestamp in RTC 3.0.1.1?
Hello,
I have a custom attribute of type timestamp and there is a calculated value attribute customization associated with it that will insert a date value based on certain conditions.
I have noticed that the script will throw a java.lang.NullPointerException when it doesn't meet the conditions for setting a date value, presumably because it won't accept "null" as a return value even though the value, if read from the attribute, is currently "null" (in some cases the attribute does not need to be set and so null should be valid).
Is there any way of programming the script so that the java.lang.NullPointerException doesn't appear?
I have tried to remove the return completely but that doesn't change anything.
Any ideas?
Regards,
Andrew
|
3 answers
Hello Andrew,
details on the NPE (stack) and a look at the js source code would help here. I these can't be shared in the open, feel free to send them to me. Thanks. Eric. Comments
Andrew Trobec
commented Mar 12 '13, 11:42 a.m.
Hello Eric,
I added a response as another answer to this question since there I did not have enough characters to write here.
Regards,
Andrew
|
Hello Eric,
Thank you for your interest. Since the comment is too small, I will give you the info here in a reply in the thread:
The NPE:
And the code is here:
When a new work item is created the script is run and it goes to the else statement which is "return null;". This throws the "java.lang.NullPointerException". I have even tried "return workItem.getValue(attributeId)" which the current value, but I get the same exception.
Best regards,
Andrew
|
Thanks Andrew,
the line: var currentLength = workItem.getValue("com.acn.adt.attribute.changerequest.hasstatechanged").length; might be the suspect. if returned value is null, then you'll get the NPE no? Comments
Andrew Trobec
commented Mar 12 '13, 12:37 p.m.
I don't think this causes the error. It is just one example where I have a calculated value for a timestamp that, when returning null, gives me the java.lang.NullPointerException. If I replace the content of the else clause with Then everything works fine. I want to be able to return null, or at least stop the script throwing the exception.
Regards,
Andrew
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.