logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

[jira] Commented: (AMQ-718) Incorrect length specification in loose encodin: msg#00198

java.activemq.devel

Subject: [jira] Commented: (AMQ-718) Incorrect length specification in loose encoding?

[
https://issues.apache.org/activemq/browse/AMQ-718?page=comments#action_36203 ]

Hiram Chirino commented on AMQ-718:
-----------------------------------

Hi Adrew.. this stuf is not easy grok.. glad your keeping us honest.

Your right, I stand corrected, the size field holds the size of the
type+playload fields. For a sec there I was thinking it only held the size of
the payload.

I now agree with your anyalisys that the original patch to line 253 is valid.
And also found that the sizePrefixDisabled option was not being honorred in the
tight encoding case for that method. This is the new patch what I will be
applying shortly.

Index:
/Users/chirino/sandbox/activemq-4-branch/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
===================================================================
---
/Users/chirino/sandbox/activemq-4-branch/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
(revision 399345)
+++
/Users/chirino/sandbox/activemq-4-branch/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
(working copy)
@@ -233,11 +233,15 @@
BooleanStream bs = new BooleanStream();
size += dsm.tightMarshal1(this, c, bs);
size += bs.marshalledSize();
-
- dataOut.writeInt(size);
+
+ if( !sizePrefixDisabled ) {
+ dataOut.writeInt(size);
+ }
+
dataOut.writeByte(type);
bs.marshal(dataOut);
dsm.tightMarshal2(this, c, dataOut, bs);
+
} else {
DataOutputStream looseOut = dataOut;
ByteArrayOutputStream baos=null;
@@ -253,7 +257,7 @@
if( !sizePrefixDisabled ) {
looseOut.close();
ByteSequence sequence = baos.toByteSequence();
- dataOut.writeInt(sequence.getLength()-4);
+ dataOut.writeInt(sequence.getLength());
dataOut.write(sequence.getData(), sequence.getOffset(),
sequence.getLength());
}



> Incorrect length specification in loose encoding?
> -------------------------------------------------
>
> Key: AMQ-718
> URL: https://issues.apache.org/activemq/browse/AMQ-718
> Project: ActiveMQ
> Type: Bug

> Components: Transport
> Versions: 4.0, 4.0 RC2, 4.0 RC3
> Reporter: Andrew Lusk
> Assignee: Hiram Chirino
> Fix For: 4.1

>
>
> Unless loose-encoded length is mean to mean something different from
> tight-encoded length, I believe that the length written to the wire for
> loosely-encoded OpenWire messages is off by 4. I imagine this hasn't been
> caught before because most clients synchronously read packets off the wire
> and so can ignore the length specification.
> ---
> activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
> (revision 399408)
> +++
> activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
> (working copy)
> @@ -172,7 +172,7 @@
> sequence = baos.toByteSequence();
>
> if( !sizePrefixDisabled ) {
> - size = sequence.getLength()-4;
> + size = sequence.getLength();
> ByteArrayPacket packet = new
> ByteArrayPacket(sequence);
> PacketData.writeIntBig(packet, size);
> }
> @@ -253,7 +253,7 @@
> if( !sizePrefixDisabled ) {
> looseOut.close();
> ByteSequence sequence = baos.toByteSequence();
> - dataOut.writeInt(sequence.getLength()-4);
> + dataOut.writeInt(sequence.getLength());
> dataOut.write(sequence.getData(), sequence.getOffset(),
> sequence.getLength());
> }
>

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    gcc.libstdc++.c...    solaris.opensol...    information-ret...    misc.misterhous...    web.catalyst.ge...    apache.webservi...    redhat.release....    hardware.lirc/2...    kernel.autofs/2...    technology.sust...    linux.vdr/2003-...    editors.lyx.gen...    org.user-groups...    netbsd.devel.pk...    xdg.devel/2004-...    version-control...    jakarta.slide.d...    debian.packages...    creativecommons...    ports.ppc.embed...    bug-tracking.bu...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation