[ http://issues.apache.org/jira/browse/XMLRPC-61?page=all ]

Jochen Wiedmann updated XMLRPC-61:
----------------------------------

    Attachment: xmlrpc61.patch

First of all, thanks very much for the excellent bug report. I rarely find that 
people take the time to work things out so well.

Attached you find a patch, that fixes the problem. We've got to discuss on the 
xmlrpc-dev mailing list, whether this patch will make it as it is or whether 
additional changes will be required.


> XmlRpcException thrown by handler are return to client as object
> ----------------------------------------------------------------
>
>          Key: XMLRPC-61
>          URL: http://issues.apache.org/jira/browse/XMLRPC-61
>      Project: XML-RPC
>         Type: Bug
>     Versions: 2.0
>  Environment: windows 2000
> xmlrpc jar: xmlrpc-2.0.jar
>     Reporter: olivier bedelet
>     Priority: Critical
>  Attachments: xmlrpc61.patch
>
> XmlRpcException thrown by handler are return to client as object. No 
> XmlRpcException thrown by xmlrpc.execute()
> How to reproduce:
> launch the following test
> public class HandlerRemoveItemTest extends TestCase {
>     /** logging feature */
>       private static final Logger logger =
>               Logger.getLogger(HandlerRemoveItemTest .class.getName());
>     
>     /**
>      * Constructor for WorklistHandlerCancelOrderTest.
>      * @param arg0
>      */
>     public HandlerRemoveItemTest (String arg0) {
>         super(arg0);
>     }
>     public class TestLoopBack {
>         /**
>          * @throws XmlRpcException
>          */
>         public void createItem() throws XmlRpcException  {
>             logger.debug("createitem called");
>             throw new XmlRpcException(7,"Not found");
>         }
>     }
>     
>     public void testException() throws MalformedURLException
>     {
>         WebServer webserver = new WebServer (2050);
>         TestLoopBack tt = new TestLoopBack();
>         webserver.addHandler ("examples", tt);
>         webserver.start();
>         
>         XmlRpcClient xmlrpc = new XmlRpcClient ("http://localhost:2050/RPC2";);
>         Vector params = new Vector ();
>         try {
>             // this method returns a string
>             Object ob = xmlrpc.execute ("examples.createItem", params);
>             logger.debug(ob);
>             fail("an exception shall be thrown");
>         } catch (XmlRpcException e) {
>             // this is what i expect
>             e.printStackTrace();
>         } catch (IOException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>     }
> }
> the XmlRpcException shall not be returned as object ob by an XmlRpcException 
> shall be thrown

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to