Uploaded image for project: 'Pluto'
  1. Pluto
  2. PLUTO-66

TestPortlet assumes testId will be a number

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • unspecified
    • 1.0.1-rc2
    • portlets-testsuite
    • None

    Description

      In TestPortlet.doDispatch(), the following code assumes that the test portlet will be a number (line 127):

      TestConfig config = null;
      if(testId != null)

      { config = (TestConfig)configs.get(Integer.parseInt(testId)); }

      This throws a java.lang.NumberFormatException when the testId has no value which is currently the case when you click the "Return to Index" button in the test portlet.

      One way to fix this is to check for the case when testId is an empty String or when testId is not a number inside the getTestId(PortletRequest req) method. In that case, the method should return null.

      For example, the first "if" block in that method could be changed to this (line 181):

      if((testId == null || testId.trim().length() == 0) &&
      next == null && previous == null && tests.size() > 0)

      { return null; }

      Attachments

        1. patch.txt
          0.9 kB
          Ken Weiner

        Activity

          People

            Unassigned Unassigned
            kweiner Ken Weiner
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: