Uploaded image for project: 'The AndroMDA project'
  1. The AndroMDA project
  2. ANDROMDA-1246

Date validation failed due to isValidTime() function confliction.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.3
    • Component/s: None
    • Labels:
      None
    • Environment:

      Windows XP SP2, JBoss 4.2

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              overheat overheat
              Reporter:
              gjyalpha gjyalpha
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: