You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2007/01/16 19:29:42 UTC

svn commit: r496812 - in /incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid: framing/AMQResponseBody.java framing/Content.java framing/EncodingUtils.java framing/ResponseManager.java protocol/AMQProtocolWriter.java

Author: rhs
Date: Tue Jan 16 10:29:41 2007
New Revision: 496812

URL: http://svn.apache.org/viewvc?view=rev&rev=496812
Log:
fixed several encoding/decoding bugs

Modified:
    incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQResponseBody.java
    incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/Content.java
    incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java
    incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/ResponseManager.java
    incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/protocol/AMQProtocolWriter.java

Modified: incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQResponseBody.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQResponseBody.java?view=diff&rev=496812&r1=496811&r2=496812
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQResponseBody.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/AMQResponseBody.java Tue Jan 16 10:29:41 2007
@@ -34,7 +34,7 @@
 
     // Constructor
     public AMQResponseBody() {}
-    public AMQResponseBody(long getResponseId, long getRequestId,
+    public AMQResponseBody(long responseId, long requestId,
             int batchOffset, AMQMethodBody methodPayload)
     {
         this.responseId = responseId;

Modified: incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/Content.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/Content.java?view=diff&rev=496812&r1=496811&r2=496812
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/Content.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/Content.java Tue Jan 16 10:29:41 2007
@@ -105,9 +105,9 @@
         EncodingUtils.writeLongStringBytes(buffer, content);
     }
     
-    public void populateFromBuffer(ByteBuffer buffer, long size) throws AMQFrameDecodingException
+    public void populateFromBuffer(ByteBuffer buffer) throws AMQFrameDecodingException
     {
-   		contentType = ContentTypeEnum.toContentEnum(buffer.get());
-   		content = EncodingUtils.readLongstr(buffer);
+        contentType = ContentTypeEnum.toContentEnum(buffer.get());
+        content = EncodingUtils.readLongstr(buffer);
     }
 }

Modified: incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java?view=diff&rev=496812&r1=496811&r2=496812
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java Tue Jan 16 10:29:41 2007
@@ -307,9 +307,8 @@
 
     public static Content readContent(ByteBuffer buffer) throws AMQFrameDecodingException
     {
-        long length = buffer.getUnsignedInt();
     	Content content = new Content();
-        content.populateFromBuffer(buffer, length);
+        content.populateFromBuffer(buffer);
         return content;
     }
 

Modified: incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/ResponseManager.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/ResponseManager.java?view=diff&rev=496812&r1=496811&r2=496812
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/ResponseManager.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/framing/ResponseManager.java Tue Jan 16 10:29:41 2007
@@ -52,7 +52,7 @@
      *     function xxxx(). (TODO)
      */
     public enum batchResponseModeEnum { NONE }
-    private batchResponseModeEnum batchResponseMode;
+    private batchResponseModeEnum batchResponseMode = batchResponseModeEnum.NONE;
 
     /**
      * Request and response frames must have a requestID and responseID which
@@ -121,7 +121,7 @@
         ResponseStatus responseStatus = responseMap.get(requestId);
         if (responseStatus == null)
             throw new RequestResponseMappingException(requestId,
-                "Failed to locate requestId " + requestId + " in responseMap.");
+                "Failed to locate requestId " + requestId + " in responseMap." + responseMap);
         if (responseStatus.responseMethodBody != null)
             throw new RequestResponseMappingException(requestId, "RequestId " +
                 requestId + " already has a response in responseMap.");
@@ -218,7 +218,7 @@
     private void sendResponseBatch(long firstRequestId, int numAdditionalRequests,
         AMQMethodBody responseMethodBody)
     {
-        long responseId = getNextResponseId(); // Get new request ID
+        long responseId = getNextResponseId(); // Get new response ID
         AMQFrame responseFrame = AMQResponseBody.createAMQFrame(channel, responseId,
             firstRequestId, numAdditionalRequests, responseMethodBody);
         protocolWriter.writeFrame(responseFrame);

Modified: incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/protocol/AMQProtocolWriter.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/protocol/AMQProtocolWriter.java?view=diff&rev=496812&r1=496811&r2=496812
==============================================================================
--- incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/protocol/AMQProtocolWriter.java (original)
+++ incubator/qpid/branches/qpid.0-9/java/common/src/main/java/org/apache/qpid/protocol/AMQProtocolWriter.java Tue Jan 16 10:29:41 2007
@@ -32,8 +32,8 @@
      * Write a datablock, encoding where necessary (e.g. into a sequence of bytes)
      * @param frame the frame to be encoded and written
      */
-	public void writeFrame(AMQDataBlock frame);
-    
+    public void writeFrame(AMQDataBlock frame);
+
     public long writeRequest(int channelNum, AMQMethodBody methodBody,
                              AMQMethodListener methodListener)
         throws AMQException;