Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

"Return False" resulting java.lang.NumberFormatException: For input string: "false”

My customer is writing a script to access value of timestamp so that once timestamp attribute does not contain value, it will write data otherwise it will not take any action. Therefore customer used "return false".

Script works fine when attribute is empty - inputs timestamp value, however when the attribute already contain value, it will generate java.lang.NumberFormatException: For input string: "false” in log file.

Could you please refer to below script and advise how script will need to be modified in order to avoid current error?

-------------------
dojo.provide("com.ibm.providers.script.TimeStampTest");

(function() {
    dojo.declare("com.ibm.providers.script.TimeStampTest", null, {
   
        getValue: function(attribute, workItem, configuration) {
            dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
            dojo.require("dojo.date.stamp");
       
            var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
            var WorkItemState = workItem.getValue(WorkItemAttributes.STATE);
           
            if ( WokkItemState == "com.ibm.workflow.state.s4" ) {
                 var cm_act_start_date= dojo.date.stamp.fromISOString(workItem.getValue("com.ibm.workitem.attribute.cm_act_start_date"));
                
                 if (cm_act_start_date == null){
                     var currentDate = new Date();
                     var currentDateString= dojo.date.stamp.toISOString(currentDate, {milliseconds:true, zulu:true});
                     
                     return currentDateString;
                 } else {
                     return false;
                 }
             } else {
                return false;
             }
        }
    });
})();
-------------------

0 votes



One answer

Permanent link
as you might already know, the value "false" wouldn't match the expected "timestamp" and hence the format error.  the "do nothing" part of this script is difficult to achieve as when a script is called it would return something.  to nullify the effect, i would attempt to return the read value when there is some value.  the number format error wouldn't appear and since the same value is written back, giving a overall effect of no change.  hope it helps, I haven't tested this though...

1 vote

Comments

Thank you for your suggestion. I will give a try!

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 42

Question asked: Apr 08 '13, 1:54 a.m.

Question was seen: 6,895 times

Last updated: Apr 10 '13, 1:05 a.m.

Confirmation Cancel Confirm