It's all about the answers!

Ask a question

Error invoking validator - com.ibm.team.workitem.valueproviders.VALIDATOR._WPftQIBqEeWJZe1YTWhytQ


Balamurugan Selvarasu (331430) | asked Mar 01 '16, 5:57 a.m.
Hi,

I am getting below exception messages in ccm logs and this makes the server performance very slow.

2016-03-01 14:26:30,318 [WebContainer : 3 @@ 14:26 soalagappan <com.ibm.team.workitem.newWorkItem/Save@e6e831a7-8797-4719-89f0-064f2597ace2> /ccm/service/com.ibm.team.workitem.common.internal.rest.IWorkItemRestService/workItem2] ERROR com.ibm.team.workitem.common                        - Error invoking validator com.ibm.team.workitem.valueproviders.VALIDATOR._WPftQIBqEeWJZe1YTWhytQ
com.ibm.team.repository.common.TeamRepositoryException: Unexpected exception type
	at com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider.handleException(ScriptAttributeValueProvider.java:281)
	at com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider.validate(ScriptAttributeValueProvider.java:149)

Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot call method "getFullYear" of null ({"Bundle-SymbolicName":"org.dojotoolkit.dojo", "path":"\\resources", "name":"date.js"}#224)

Has anyone experienced this issue?

5 answers



permanent link
Ralph Schoon (63.1k33645) | answered Mar 01 '16, 6:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
As the log says, there is a JavaScript based validator that causes an error when being called. Not sure why and what, but you can use the process configuration source and search for
_WPftQIBqEeWJZe1YTWhytQ
This should allow you to find the configuration in the process.

permanent link
Balamurugan Selvarasu (331430) | answered Mar 01 '16, 6:51 a.m.
Hi Ralph,

I already found the java script which causing the problem. This script used to validate the past date selection in a time stamp attribute.

Script below:

/*******************************************************************************
* Licensed Materials - Property of IBM
* (c) Copyright IBM Corporation 2011. All Rights Reserved.
*
* Note to U.S. Government Users Restricted Rights: 
* Use, duplication or disclosure restricted by GSA ADP Schedule
* Contract with IBM Corp.
*******************************************************************************/
dojo.provide("test");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("com.ibm.team.workitem.api.common.Severity");
dojo.require("com.ibm.team.workitem.api.common.Status");
dojo.require("dojo.date");
dojo.require("dojo.date.stamp");

(function() {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
var Severity= com.ibm.team.workitem.api.common.Severity;
var Status= com.ibm.team.workitem.api.common.Status;

    dojo.declare("test", null, {

        validate: function(attribute, workItem, configuration) {

var defectstate = workItem.getLabel(WorkItemAttributes.STATE);
var targetfixdate = dojo.date.stamp.fromISOString(workItem.getValue("attributeid"));
        var currDate = new Date();
        var Daydiff = dojo.date.difference(targetfixdate, currDate, "day");
        
        if ( Daydiff < 1 ) {
return Status.OK_STATUS;
        } else {
         return new Status(Severity["ERROR"], "Target fixed date cannot be past date");
           }

        }
    });
})();

Do you find any issue in the above script?

Comments
Ralph Schoon commented Mar 01 '16, 7:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

According to the posts from you you seem to have multiple issues with attribute customization. I cant say where all these scripts come from and where they break.


Donald Nong commented Mar 01 '16, 9:47 p.m.

Not sure whether you actually locate the correct script. The error in the OP is

org.mozilla.javascript.EcmaError: TypeError: Cannot call method "getFullYear" of null ({"Bundle-SymbolicName":"org.dojotoolkit.dojo", "path":"\resources", "name":"date.js"}#224)
Apparently, in your script there should be a line similar to "xxx.getFullYear" but "xxx" is null when the function is called.


Nate Decker commented Mar 04 '16, 1:17 p.m.

This line seems questionable:

var targetfixdate = dojo.date.stamp.fromISOString(workItem.getValue("attributeid"));

What is "attributeid"? I'm guessing this is some kind of placeholder text that was supposed to be replaced, but has not yet been.


Donald Nong commented Mar 06 '16, 7:45 p.m.

Nate is right. You should make sure "attributeid" is the right ID for the attribute "Target Fix Date". It appears that the variable "targetfixdate" is null when the function dojo.date.difference(targetfixdate, currDate, "day") is called, hence the error - the below screenshot show the exact line in dojo.date.js that throws this error.


permanent link
Balamurugan Selvarasu (331430) | answered Mar 01 '16, 7:42 a.m.
What could be the issue with the first exception message with respect to validators script.

2016-03-01 14:26:30,318 [WebContainer : 3 @@ 14:26 soalagappan <com.ibm.team.workitem.newworkitem Save@e6e831a7-8797-4719-89f0-064f2597ace2=""> /ccm/service/com.ibm.team.workitem.common.internal.rest.IWorkItemRestService/workItem2] ERROR com.ibm.team.workitem.common                        - Error invoking validator com.ibm.team.workitem.valueproviders.VALIDATOR._WPftQIBqEeWJZe1YTWhytQ
com.ibm.team.repository.common.TeamRepositoryException: Unexpected exception type.


permanent link
Balamurugan Selvarasu (331430) | answered Mar 04 '16, 6:40 a.m.
 Unfortunately I don't have this line in my script. How to troubleshoot this issue? 

Comments
Tadeusz Janasiewicz commented Mar 04 '16, 8:27 a.m.

You should find the changes that were made at the time when this error was thrown (user ID as well as the time you will find in the error message details) and using those data you can debug this script using Firebug.

In this case you should find which line in this script is affected that should help.


permanent link
Tadeusz Janasiewicz (120149) | answered Mar 11 '16, 4:24 p.m.
Hi Balamurugan,

The issue is related with the attributes passing in the dojo.date.difference() function.
You should shift them and the one that can be NULL should be the second one as only the second one is optional.
Right now targetfixdate when is NULL you will see this error message as this script will end on the line where you are calculating day difference:

var Daydiff = dojo.date.difference(targetfixdate, currDate, "day");

More details about this function you will find here:
dojotoolkit guide

Please notice that:
// Returns the difference in the specified interval

date
.difference(date1, date2, "week");
where:

date1 Date The first date for the difference.
date2 Date? Optional argument The second date for the difference. Defaults to current Date.

Your answer


Register or to post your answer.