User: lqd
Date: 01/12/12 07:17:46
Modified: src/main/org/jboss/mq Tag: Branch_2_4 SpyTextMessage.java
Log:
fix bug in isVersion2() method: the logic has to be reversed to work
correctly. added JavaDoc on this.
Revision Changes Path
No revision
No revision
1.2.2.5 +9 -5 jbossmq/src/main/org/jboss/mq/SpyTextMessage.java
Index: SpyTextMessage.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jboss/mq/SpyTextMessage.java,v
retrieving revision 1.2.2.4
retrieving revision 1.2.2.5
diff -u -r1.2.2.4 -r1.2.2.5
--- SpyTextMessage.java 2001/12/08 23:26:09 1.2.2.4
+++ SpyTextMessage.java 2001/12/12 15:17:46 1.2.2.5
@@ -17,14 +17,14 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
* @created August 16, 2001
- * @version $Revision: 1.2.2.4 $
+ * @version $Revision: 1.2.2.5 $
*/
public class SpyTextMessage
extends SpyMessage
implements Cloneable, TextMessage, Externalizable
{
private final static long serialVersionUID = 235726945332013953L;
-
+
// Maximum length of a String so that it can be safely written
// using readUTF() / writeUTF() methods
public final static int MAX_UTF_LENGTH = 65535 / 3;
@@ -70,6 +70,10 @@
* one chunk of UTF data or if the data has to be split into more
* parts based on the DataOutput.writeUTF limitation of only allowing
* 65535 bytes per write.
+ *
+ * @return true if the message has to be written out in several
+ * chunks, false if it can be written out in one go (i.e. the
+ * message is Version 1 compatible).
*/
final public boolean isVersion2()
{
@@ -95,7 +99,7 @@
}
canWriteUTF = writeUTFLength <= 65535;
}
- return canWriteUTF;
+ return !canWriteUTF;
}
public void readExternal( java.io.ObjectInput in )
@@ -152,7 +156,7 @@
endCopy = beginCopy + MAX_UTF_LENGTH;
if ( endCopy > content.length() )
endCopy = content.length();
-
+
out.writeUTF( content.substring(beginCopy, endCopy) );
}
@@ -163,7 +167,7 @@
}
}
}
-
+
// Object override -----------------------------------------------
public String toString()
{
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development