spacewalkproject/spacewalk — pull request #131 by isbm (2014-07-31 16:49:20+00:00)
Title: XML-RPC and Fault Codes

The XML-RPC BaseHandler in the method getLoggedInUser (https://github.com/spacewalkproject/spacewalk/blob/master/java/code/src/com/redhat/rhn/frontend/xmlrpc/BaseHandler.java#L273) does not throws XmlRpcFault (http://xmlrpc.sourceforge.net/javadoc/redstone/xmlrpc/XmlRpcFault.html) which contains *error codes* but only *error strings*, that are described in exception ranges file (https://github.com/spacewalkproject/spacewalk/blob/master/java/code/src/com/redhat/rhn/frontend/xmlrpc/exception_ranges.txt).

This leads to a not so nice "guesswork" (https://github.com/spacewalkproject/spacewalk/blob/master/spacecmd/src/bin/spacecmd#L179) or unknown XML-RPC exception, but also potentially fragile on different locales where might be returned non-English error string.

Proposed solution does the following:
1. Wraps these errors to XML-RPC faults and throw a proper error codes. This fix includes backward-compatibility, in case somebody somewhere still relies on strings.
2. Improves spacecmd
3. Contains bonus bugfix (in a separate commit) for spacecmd crash, which happens if user issues ^C instead of password during the login.