|
From: <tre...@us...> - 2008-03-19 03:05:20
|
Revision: 793
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=793&view=rev
Author: trevorolio
Date: 2008-03-18 20:05:25 -0700 (Tue, 18 Mar 2008)
Log Message:
-----------
Another bug fix in the chunked network code, this time from Matt K. at the Electric Sheep Company.
Thanks, Matt!
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/plugin/ChunkedStreamNetworkTransporter.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/plugin/ChunkedStreamNetworkTransporter.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/plugin/ChunkedStreamNetworkTransporter.java 2008-03-17 20:41:15 UTC (rev 792)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/plugin/ChunkedStreamNetworkTransporter.java 2008-03-19 03:05:25 UTC (rev 793)
@@ -104,6 +104,12 @@
// Parse the chunked message length
int overallMessageLength = Integer.parseInt(messageLengthBuffer.toString(), 16);
+ // If the chunked message length is 0, we've been disconnected. Throw a
+ // NegativeReadValueException.
+ if (overallMessageLength == 0) {
+ throw new NegativeReadValueException("EOC received in ChunkedStreamNetworkTransporter");
+ }
+
// Read in the message length header to get the true message length.
int messageLength = decodeMessageLength();
@@ -127,17 +133,11 @@
throw new MessagingException("Amount of data read does not match message length:" +
totalBytes + " vs "+messageLength);
}
-
- // Eat the closing \r\n
- inputStream.read();
- inputStream.read();
}
- // If the message length is 0, we've been disconnected. Throw a
- // NegativeReadValueException.
- if (messageLength == 0) {
- throw new NegativeReadValueException("EOC received in ChunkedStreamNetworkTransporter");
- }
+ // Eat the closing \r\n
+ inputStream.read();
+ inputStream.read();
return buffer;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|