rhoegg      2003/02/07 21:09:28

  Modified:    src/test/org/apache/xmlrpc/applet Tag: XMLRPC_1_2_BRANCH
                        AppletTest.java
               src/java/org/apache/xmlrpc/applet Tag: XMLRPC_1_2_BRANCH
                        SimpleXmlRpcClient.java
  Log:
  Added test and patch for Bug 15097.  Problem was that SimpleXmlRpcClient
  did not detect fault responses.  It now passes the test.  Thanks to Wim
  van Velthoven <[EMAIL PROTECTED]>.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +27 -1     xml-rpc/src/test/org/apache/xmlrpc/applet/Attic/AppletTest.java
  
  Index: AppletTest.java
  ===================================================================
  RCS file: /home/cvs/xml-rpc/src/test/org/apache/xmlrpc/applet/Attic/AppletTest.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- AppletTest.java   7 Feb 2003 23:25:32 -0000       1.1.2.1
  +++ AppletTest.java   8 Feb 2003 05:09:27 -0000       1.1.2.2
  @@ -262,12 +262,38 @@
               fail (e.getMessage());
           }
       }
  +    
  +    /**
  +     * Tests that the client knows there was a fault
  +     */
  +    public void testDetectFault()
  +    {
  +        Vector params = new Vector();
  +        try
  +        {
  +            Object response = client.execute(HANDLER_NAME + ".breakMe", params);
  +            fail("Should have thrown an XmlRpcException!");
  +        }
  +        catch (IOException e)
  +        {
  +            fail(e.getMessage());
  +        }
  +        catch (XmlRpcException e)
  +        {
  +            // all is well.
  +        }
  +    }
   
       protected class TestHandler
       {
           public String echo(String message)
           {
               return message;
  +        }
  +        
  +        public String breakMe() throws Exception
  +        {
  +            throw new Exception("Calling breakMe is not allowed!");
           }
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.3   +6 -2      
xml-rpc/src/java/org/apache/xmlrpc/applet/SimpleXmlRpcClient.java
  
  Index: SimpleXmlRpcClient.java
  ===================================================================
  RCS file: 
/home/cvs/xml-rpc/src/java/org/apache/xmlrpc/applet/SimpleXmlRpcClient.java,v
  retrieving revision 1.5.2.2
  retrieving revision 1.5.2.3
  diff -u -r1.5.2.2 -r1.5.2.3
  --- SimpleXmlRpcClient.java   8 Feb 2003 04:11:24 -0000       1.5.2.2
  +++ SimpleXmlRpcClient.java   8 Feb 2003 05:09:28 -0000       1.5.2.3
  @@ -466,7 +466,11 @@
               System.err.println("startElement: " + name);
           }
   
  -        if ("value".equals(name))
  +        if( "fault".equals(name)) 
  +        { 
  +            fault = true; 
  +        } 
  +        else if ("value".equals(name))
           {
               // System.err.println ("starting value");
               Value v = new Value();
  
  
  


Reply via email to