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 jo...@apache.org on 2005/04/15 22:29:55 UTC

cvs commit: ws-xmlrpc/src/java/org/apache/xmlrpc XmlRpcClientWorker.java

jochen      2005/04/15 13:29:55

  Modified:    src/java/org/apache/xmlrpc XmlRpcClientWorker.java
  Log:
  Fixed that an exception thrown in finally could hide an earlier exception.
  
  Revision  Changes    Path
  1.3       +13 -8     ws-xmlrpc/src/java/org/apache/xmlrpc/XmlRpcClientWorker.java
  
  Index: XmlRpcClientWorker.java
  ===================================================================
  RCS file: /home/cvs/ws-xmlrpc/src/java/org/apache/xmlrpc/XmlRpcClientWorker.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XmlRpcClientWorker.java	30 Mar 2005 11:19:18 -0000	1.2
  +++ XmlRpcClientWorker.java	15 Apr 2005 20:29:55 -0000	1.3
  @@ -95,6 +95,7 @@
               now = System.currentTimeMillis();
           }
   
  +		boolean endClientDone = false;
           try
           {
               byte [] request = requestProcessor.encodeRequestBytes(xmlRpcRequest, responseProcessor.getEncoding());
  @@ -106,6 +107,8 @@
               }
               else
               {
  +		      endClientDone = true;
  +			  transport.endClientRequest();
                 return response;
               }
           }
  @@ -136,14 +139,16 @@
                   System.out.println("Spent " + (System.currentTimeMillis() - now)
                                      + " millis in request/process/response");
               }
  -            try
  -            {
  -                transport.endClientRequest();
  -            }
  -            catch (RuntimeException re)
  -            {
  -                throw new XmlRpcClientException("Transport exception in endClientRequest()", re);
  -            }
  +			if (!endClientDone)
  +			{
  +				try
  +	            {
  +	                transport.endClientRequest();
  +	            }
  +	            catch (Throwable ignore)
  +	            {
  +	            }
  +			}
           }
       }
   
  
  
  

Re: cvs commit: ws-xmlrpc/src/java/org/apache/xmlrpc XmlRpcClientWorker.java

Posted by Jochen Wiedmann <jo...@gmail.com>.
Daniel Rall wrote:

> I've modified this implementation in CVS rev 1.4.

To be honest, I found my implementation *much* more simple and readable
than yours...

Re: cvs commit: ws-xmlrpc/src/java/org/apache/xmlrpc XmlRpcClientWorker.java

Posted by Daniel Rall <dl...@finemaltcoding.com>.
I've modified this implementation in CVS rev 1.4.

On Fri, 2005-04-15 at 20:29 +0000, jochen@apache.org wrote:
>jochen      2005/04/15 13:29:55
>
>  Modified:    src/java/org/apache/xmlrpc XmlRpcClientWorker.java
>  Log:
>  Fixed that an exception thrown in finally could hide an earlier exception.
>  
>  Revision  Changes    Path
>  1.3       +13 -8     ws-xmlrpc/src/java/org/apache/xmlrpc/XmlRpcClientWorker.java
>  
>  Index: XmlRpcClientWorker.java
>  ===================================================================
>  RCS file: /home/cvs/ws-xmlrpc/src/java/org/apache/xmlrpc/XmlRpcClientWorker.java,v
>  retrieving revision 1.2
>  retrieving revision 1.3
>  diff -u -r1.2 -r1.3
>  --- XmlRpcClientWorker.java	30 Mar 2005 11:19:18 -0000	1.2
>  +++ XmlRpcClientWorker.java	15 Apr 2005 20:29:55 -0000	1.3
>  @@ -95,6 +95,7 @@
>               now = System.currentTimeMillis();
>           }
>   
>  +		boolean endClientDone = false;
>           try
>           {
>               byte [] request = requestProcessor.encodeRequestBytes(xmlRpcRequest, responseProcessor.getEncoding());
>  @@ -106,6 +107,8 @@
>               }
>               else
>               {
>  +		      endClientDone = true;
>  +			  transport.endClientRequest();
>                 return response;
>               }
>           }
>  @@ -136,14 +139,16 @@
>                   System.out.println("Spent " + (System.currentTimeMillis() - now)
>                                      + " millis in request/process/response");
>               }
>  -            try
>  -            {
>  -                transport.endClientRequest();
>  -            }
>  -            catch (RuntimeException re)
>  -            {
>  -                throw new XmlRpcClientException("Transport exception in endClientRequest()", re);
>  -            }
>  +			if (!endClientDone)
>  +			{
>  +				try
>  +	            {
>  +	                transport.endClientRequest();
>  +	            }
>  +	            catch (Throwable ignore)
>  +	            {
>  +	            }
>  +			}
>           }
>       }
>   
>  
>  
>