Bug 606555

Summary: Misleading error message if arguments passed to RHN API call is of incorrectly type
Product: Red Hat Satellite 5 Reporter: Xixi <xdmoon>
Component: APIAssignee: Tomas Lestach <tlestach>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Sklenar <psklenar>
Severity: medium Docs Contact:
Priority: medium    
Version: 530CC: cperry, jhutar, msuchy, psklenar, xdmoon
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: Fixed in the 5.4.0 Release - GA'd 2010-10-27
Fixed In Version: spacewalk-java-1.2.38-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-28 15:03:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 608752    

Description Xixi 2010-06-21 23:19:26 UTC
Description of problem:
The RHN API returns "Fault returned from XML RPC Server, fault code -1: redstone.xmlrpc.XmlRpcFault: Could not find method" error if the data structure passed to API call is incorrectly typed, this is expected (as inherent in Java), but is misleading to the user.  Would be better to throw and catch another exception with a more helpful/instructive error message (possibly type checking or a generic message to check type?), if possible.

Example:
Write an API for channel.software.addPackages and instead of passing a reference of array, pass an array. So instead of \@addPkg pass @addPkg
Example:
my $success = $client->call('channel.software.addPackages', $session, 'activationkey-test',@addPkg);

This will return:
Fault returned from XML RPC Server, fault code -1: redstone.xmlrpc.XmlRpcFault: Could not find method addPackages in class class com.redhat.rhn.frontend.xmlrpc.channel.software.ChannelSoftwareHandler

Version-Release number of selected component (if applicable):
Red Hat Network (RHN) Satellite 5.3.0

How reproducible:
Always.

Steps to Reproduce:
See above.

Actual results:
See above.

Expected results:
See above - a more helpful/instructive error message (possibly type checking or a generic message to suggest user to check type?).

Additional info:

Comment 1 Clifford Perry 2010-07-12 17:02:19 UTC
Lower priority. This may not be easy to implement or cause regressions in designing since it would be at a global level, or touching every lots of code everywhere. 

Cliff.

Comment 2 Tomas Lestach 2010-09-10 10:10:26 UTC
Adding information about the parameter types into the exception.
So, the example provided in #Description would return following (@addPkg contains two items):

Fault returned from XML RPC Server, fault code -1: redstone.xmlrpc.XmlRpcFault: Could not find method: addPackages in class: com.redhat.rhn.frontend.xmlrpc.channel.software.ChannelSoftwareHandler with params: [java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer]


Hope this helps the user to identify the problem quicker.

spacewalk.git: 079f75dfb66a8daf0b051d972c5d8bec6645861e

Comment 5 Clifford Perry 2010-10-28 15:03:10 UTC
The 5.4.0 RHN Satellite and RHN Proxy release has occurred. This issue has been resolved with this release. 


RHEA-2010:0801 - RHN Satellite Server 5.4.0 Upgrade
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10332

RHEA-2010:0803 - RHN Tools enhancement update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10333

RHEA-2010:0802 - RHN Proxy Server 5.4.0 bug fix update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10334

RHEA-2010:0800 - RHN Satellite Server 5.4.0
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10335

Docs are available:

http://docs.redhat.com/docs/en-US/Red_Hat_Network_Satellite/index.html 

Regards,
Clifford