You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by ae...@apache.org on 2003/01/29 14:16:25 UTC
cvs commit: xml-rpc/src/java/org/apache/xmlrpc XmlRpcResponseProcessor.java
aevers 2003/01/29 05:16:25
Modified: src/java/org/apache/xmlrpc XmlRpcResponseProcessor.java
Log:
Allow external access to the XML-RPC faultCode via encodeException.
Revision Changes Path
1.3 +14 -3 xml-rpc/src/java/org/apache/xmlrpc/XmlRpcResponseProcessor.java
Index: XmlRpcResponseProcessor.java
===================================================================
RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcResponseProcessor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XmlRpcResponseProcessor.java 5 Dec 2002 08:49:24 -0000 1.2
+++ XmlRpcResponseProcessor.java 29 Jan 2003 13:16:25 -0000 1.3
@@ -114,9 +114,10 @@
*
* @param e The exception to process;
* @param encoding The output encoding.
+ * @param code The XML-RPC faultCode.
* @return byte[] The XML-RPC response.
*/
- public byte[] encodeException(Exception x, String encoding)
+ public byte[] encodeException(Exception x, String encoding, int code)
{
if (XmlRpc.debug)
{
@@ -149,8 +150,6 @@
String message = x.toString();
// Retrieve XmlRpcException error code(if possible).
- int code = x instanceof XmlRpcException ?
- ((XmlRpcException) x).code : 0;
try
{
writeError(code, message, writer);
@@ -167,6 +166,18 @@
return (writer != null ? buffer.toByteArray() : EMPTY_BYTE_ARRAY);
}
+ /**
+ * Process an exception, and return output in the specified
+ * encoding.
+ *
+ * @param e The exception to process;
+ * @param encoding The output encoding.
+ * @return byte[] The XML-RPC response.
+ */
+ public byte[] encodeException(Exception x, String encoding)
+ {
+ return encodeException(x, encoding, (x instanceof XmlRpcException) ? ((XmlRpcException) x).code : 0);
+ }
/**
* Writes an XML-RPC response to the XML writer.
*/