You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2008/11/07 04:28:35 UTC

svn commit: r712047 - /jakarta/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/LengthPrefixedBinaryTCPClientImpl.java

Author: sebb
Date: Thu Nov  6 19:28:35 2008
New Revision: 712047

URL: http://svn.apache.org/viewvc?rev=712047&view=rev
Log:
Check for short read

Modified:
    jakarta/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/LengthPrefixedBinaryTCPClientImpl.java

Modified: jakarta/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/LengthPrefixedBinaryTCPClientImpl.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/LengthPrefixedBinaryTCPClientImpl.java?rev=712047&r1=712046&r2=712047&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/LengthPrefixedBinaryTCPClientImpl.java (original)
+++ jakarta/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/LengthPrefixedBinaryTCPClientImpl.java Thu Nov  6 19:28:35 2008
@@ -98,29 +98,17 @@
             if (is.read(lengthBuffer, 0, lengthPrefixLen) == lengthPrefixLen) {
                 msgLen = byteArrayToInt(lengthBuffer);
                 msg = new byte[msgLen];
-                is.read(msg);
+                int bytes = is.read(msg);
+                if (bytes < msgLen){
+                    log.warn("Incomplete message read, expected: "+msgLen+" got: "+bytes);
+                }
             }
-            /*
-             * 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 (SocketTimeoutException e) {
             // drop out to handle buffer
         } catch (InterruptedIOException e) {
             // drop out to handle buffer
         } catch (IOException e) {
             log.warn("Read error:" + e);
-            return JOrphanUtils.baToHexString(msg);
         }
 
         String buffer = JOrphanUtils.baToHexString(msg);



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org