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 17:54:12 UTC

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

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


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

Posted by "Julie MacNaught (JIRA)" <ws...@ws.apache.org>.
     [ 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


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

Posted by "Diego Louzán (JIRA)" <ws...@ws.apache.org>.
     [ 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


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

Posted by "Julie MacNaught (JIRA)" <ws...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/WSRP4J-52?page=history ]
     
Julie MacNaught resolved WSRP4J-52:
-----------------------------------

      Assign To: Julie MacNaught
     Resolution: Fixed
    Fix Version: current (nightly)

> 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
>     Assignee: Julie MacNaught
>      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