Date validation failed due to isValidTime() function confliction.
-----------------------------------------------------------------

         Key: BPM-299
         URL: http://jira.andromda.org/browse/BPM-299
     Project: Bpm4Struts Cartridge
        Type: Bug

    Versions: 3.2    
 Environment: Windows XP SP2, JBoss 4.2
    Reporter: Gerry Gao
 Assigned to: Wouter Zoons 
    Priority: Minor


The bpm4struts/src/templates/bpm4struts/configuration/validator-rules.xml.vsl 
template has its own javascript for Date and Time validation. But there are two 
javascript functions with same name, one for Date validation and one for Time 
validation.

    function isValidTime(second, minute, hour) {
        return (0<=hour && hour<24 && 0<=minute && minute<60 && 0<=second && 
second<60);
    }

    function isValidTime(second, minute, hour, millisecond)
    {
        return (0 <= hour && hour < 24 && 0 <= minute && minute < 60 && 0 <= 
second && second < 60 && 0 <= millisecond && millisecond < 1000);
    }

Javascript doesn't support function overloading, so when these functions are 
both sent to browser via <html:javascript> tag, the browser will always call 
the last one. The Date validation was supposed to call the three parameters 
version, but it will actually call the four parameters version, which cause the 
date validation failed due to the missing millisecond parameter.

The solution is pretty simple, changing one function to isTimeValid() or 
anything else different from isValidTime(), and changing the corresponding 
calls to that function.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.andromda.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

Reply via email to