You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrp4j-dev@portals.apache.org by "Diego Louzán (JIRA)" <ws...@ws.apache.org> on 2005/01/11 18:05:13 UTC

[jira] Commented: (WSRP4J-52) Checking error in class ParameterChecker

     [ http://issues.apache.org/jira/browse/WSRP4J-52?page=comments#action_57519 ]
     
Diego Louzán commented on WSRP4J-52:
------------------------------------

In fact, all "else if" statements have to be renamed to "if" statements, because the checks have to be done on all optional elements that are set in the response.

> Checking error in class ParameterChecker
> ----------------------------------------
>
>          Key: WSRP4J-52
>          URL: http://issues.apache.org/jira/browse/WSRP4J-52
>      Project: WSRP4J
>         Type: Bug
>   Components: Producer, Consumer
>     Versions: current (nightly)
>     Reporter: Diego Louzán

>
> In method check(ServiceDescription response) of class org.apache.wsrp4j.util.ParameterChecker:
> public void check(ServiceDescription response) throws MissingParametersFault
> {
>     if (isCheckEnabled())
>     {
>         // check ServiceDescription  object pointer
>         if (response instanceof ServiceDescription)
>         {
>             if (response != null)
>             {
>             } else if (response.getOfferedPortlets() != null)
>             {
> 		PortletDescription[] portletDesc =
>                         response.getOfferedPortlets();
>                 for (int i = 0; i < portletDesc.length; i++)
>                 {
>                     check(portletDesc[i]);
>                 }
>             } else if (response.getRequiresInitCookie() != null)
>             {
>                 check(response.getRequiresInitCookie(), true);
>             } else if (response.getResourceList() != null)
>             {
>                 check(response.getResourceList(), true);
>             } else
>             {
>                 throwMissingParametersFault("No valid service description.");
>             }
>         } else
>         {
>             throwMissingParametersFault("No valid service description response found.");
>         }
>     }
> }
>     This code ignores all checks on the ServiceDescription object, because when it reaches the "if (response != null)", the response is always non-null ("null instanceof <class>" always returns false), so it executes an empty sentence and exits.
>     The solution is to remove the first "if" sentence and let the sentence "if (response.getOfferedPortlets() != null)" be the first "if" executed.

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