How can I stop an RTC Value Provider with no value to return from reporting an error
Bill Taylor (31●4●4)
| asked Jun 19 '12, 4:58 a.m.
edited Jul 11 '12, 8:35 p.m. by Jared Burns (4.5k●2●9)
Using RTC 3.0.1.3, I have a value provider that records the date when a work item changes its state to "In Progress". The field it updates is dependent on "Status". It is working fine, but I am getting:
Error invoking value provider 'lbg.valueproviders.inProgressDateProvider' The error occurs when I have no value to return, e.g. when the work item is created or when it first enters the "New" state. I can avoid the error when the state changes to "Done" by returning the current value. How can I avoid the error? I have ten similar value providers and it doesn't look good to the customer to have dozens of entries in the Error Log |
One answer
Millard Ellingsworth (2.5k●1●24●31)
| answered Jul 11 '12, 6:30 p.m.
FORUM ADMINISTRATOR / JAZZ DEVELOPER edited Jul 12 '12, 1:39 p.m.
Sorry for the delay in getting back to you, Bill (yes, my vacation was lovely).
I tested this in 3.0.1.3 and I see the errors -- and the stack trace isn't very helpful.
When I test in 4.0, I still see the errors, but they now report a Null Pointer Exception -- which is largely accurate because you are returning a null from getValue() which may have a right to expect you to return something. I'm working on clarifying the actual requirements (i.e., should you be expected to return a non-null value) and how we should better handle this on our end -- dumping an exception to the log doesn't seem particularly useful.
UPDATE: An error should not be getting thrown. I have filed a defect for the issue. https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=217542
|
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.
Comments
What are you returning in the cases where you don't have a Date to return? Are you comfortable posting the script here (or a snippet of it that might help us debug)?
I am returning the old value (workItem.getValue(attribute)), which is null when the work item is first created. I have no problem sending the script, but I foolishly wasted too many of the character limit in my first posting.
(function() { var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes; dojo.declare("xxxxxx", null, { getValue: function(attribute, workItem, configuration) { var now = dojo.date.stamp.toISOString(new Date(), {milliseconds:true, zulu:true}); var state = workItem.getValue(WorkItemAttributes.STATE); var myOldValue = workItem.getValue(attribute); if (state) {
switch (state) { case 'taskworkflow.state.s2': //In Progress if (myOldValue == null) { return now; } break;
} } return myOldValue; } }); }) ();