sebb        2004/01/07 16:48:39

  Modified:    src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler
                        TCPClientImpl.java
  Log:
  Make compliant with JDK1.3
  
  Revision  Changes    Path
  1.2       +17 -3     
jakarta-jmeter/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPClientImpl.java
  
  Index: TCPClientImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPClientImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TCPClientImpl.java        16 Nov 2003 02:09:06 -0000      1.1
  +++ TCPClientImpl.java        8 Jan 2004 00:48:39 -0000       1.2
  @@ -11,6 +11,7 @@
   import java.io.ByteArrayOutputStream;
   import java.io.IOException;
   import java.io.InputStream;
  +import java.io.InterruptedIOException;
   import java.io.OutputStream;
   import java.net.SocketTimeoutException;
   
  @@ -85,10 +86,23 @@
                        {
                                w.write(buffer, 0, x);
                        }
  -             } catch (SocketTimeoutException e) {
  +             /*
  +              * Timeout is reported as follows:
  +              * JDK1.3: InterruptedIOException
  +              * JDK1.4: SocketTimeoutException, which extends InterruptedIOException
  +              * 
  +              * So to make the code work on both, just check for 
InterruptedIOException
  +              *
  +              * If 1.3 support is dropped, can change to using 
SocketTimeoutException
  +              *  
  +              * For more accurate detection of timeouts under 1.3,
  +              * one could perhaps examine the Exception message text...
  +              * 
  +              */
  +             } catch (InterruptedIOException e) {
                        // drop out to handle buffer
                } catch (IOException e) {
  -                     log.debug("Read error",e);
  +                     log.warn("Read error:"+e);
                        return "";
                }
                
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to