Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8226976

SessionTimeOutTests uses == operator for String value check

    Details

      Description

      A certain part in the SessionTimeOutTests currently has the following check:

          String isTimedout = "YES";
          ...
          if (nextSess != null) {
              if (isEqualSessionId(nextSess.getId(), sess.getId())) {
                  isTimedout = "NO";
                  nextSess = null;
              }
          } else if (e.hasMoreElements()) {
              nextSess = sessCtx.getSession((byte[]) e.nextElement());
              if ((nextSess != null) && isEqualSessionId(nextSess.getId(),
                                      sess.getId())) {
                  nextSess = null;
                  isTimedout = "NO";
              }
          }

          ....
          if ((timeout != 0) && (lifetime > timeout) &&
                              (isTimedout.equals("NO"))) {
                      throw new Exception("Session timeout test failed for session: "
                                      + sess + " lifetime: " + lifetime);
                  }
          if (((timeout == 0) || (lifetime < timeout)) &&
                                (isTimedout == "YES")) {
              isTimedout = "Invalidated before timeout";
          }

      The isTimedout == "YES" isn't right and should instead use the equals() method, just like it does for the "NO" check a few lines above.

        Attachments

          Activity

            People

            • Assignee:
              jpai Jaikiran Pai
              Reporter:
              jpai Jaikiran Pai
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: