firstcup
  1. firstcup
  2. FIRSTCUP-12

Method getAgeDifference of DukesBirthdayBean returns wrong value

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: 7.0.1
    • Component/s: examples
    • Labels:
      None
    • Environment:

      Netbeans 7.3, Your Firstcup Cup, April 2012, Windows 7 64bit

      Description

      The method getAgeDifference of the enterprise bean class DukesBirthdayBean returns wrong values. That's because 1. theirBirthday and dukesBirthday are not at the same year when compared and 2. if the user is younger (<0) and dukesBirthday is after the user's one the ageDifference should be reduced.

      I have added the following code:

      // Bring the dates to the same year (the dukes Year)
      theirBirthday.add(Calendar.YEAR, ageDifference);

      // Check to see if Duke's birthday occurs before the user's when the user is older. If so,
      // subtract one from the age difference
      if (dukesBirthday.before(theirBirthday) && (ageDifference > 0)) {
      ageDifference--;
      }
      // Check to see if Duke's birthday occurs after the user's when the user is younger. If so,
      // subtract one from the age difference
      if (dukesBirthday.after(theirBirthday) && (ageDifference < 0)) {
      ageDifference++;
      }

        Activity

        Hide
        Ian Evans added a comment -

        Updated the source with the fix, and it is in version 7.0.1, in the Java EE 7 SDK.

        Show
        Ian Evans added a comment - Updated the source with the fix, and it is in version 7.0.1, in the Java EE 7 SDK.

          People

          • Assignee:
            Ian Evans
            Reporter:
            Johann_Kropf
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: