You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by pl...@jakarta.apache.org on 2004/10/15 03:19:52 UTC

[jira] Commented: (PLUTO-66) TestPortlet assumes testId will be a number

The following comment has been added to this issue:

     Author: Ken Weiner
    Created: Thu, 14 Oct 2004 6:18 PM
       Body:
Although the fix for bug 73 (http://nagoya.apache.org/jira/browse/PLUTO-73) will make this bug fix unnecessary, it is still an important bug fix because there is different behavior in uPortal versus the Pluto portal driver.

The URL for the "Return to index" link of the testsuite portlet includes a request parameter name of "testId" with no value specfied.  For example "testId=".  In Pluto's portal driver this results in a null value when request.getParameter("testId") is called.  However, in uPortal, this would return an empty String '' rather than null.  I'm not sure which one, if not both, behaviors are correct, but either way, the fix I am proposing would make the code more robust.
---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/PLUTO-66?page=comments#action_54125

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/PLUTO-66

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: PLUTO-66
    Summary: TestPortlet assumes testId will be a number
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Pluto
 Components: 
             testsuite
   Versions:
             Current CVS

   Assignee: 
   Reporter: Ken Weiner

    Created: Wed, 22 Sep 2004 5:58 PM
    Updated: Thu, 14 Oct 2004 6:18 PM

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;
        }


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira