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 "Julie MacNaught (JIRA)" <ws...@ws.apache.org> on 2005/04/11 23:25:16 UTC

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

     [ http://issues.apache.org/jira/browse/WSRP4J-52?page=comments#action_62591 ]
     
Julie MacNaught commented on WSRP4J-52:
---------------------------------------

I actually fixed this a different way than suggested.  Here is the new method body:

        if (isCheckEnabled()) {
            if (response != null) {
                // check ServiceDescription  object pointer
                if (response instanceof ServiceDescription) {

                    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.");
            }
        }


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

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