Author: rgreig
Date: Wed Feb  7 15:30:22 2007
New Revision: 504736

URL: http://svn.apache.org/viewvc?view=rev&rev=504736
Log:
Added a system property qpid.accept.broker.version to allow the client to 
accept whatever version the broker offers on connection negotiation. Useful 
when testing different broker implementations that may not be in sync with Qpid 
versioning.

Modified:
    
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java

Modified: 
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java?view=diff&rev=504736&r1=504735&r2=504736
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
 Wed Feb  7 15:30:22 2007
@@ -63,7 +63,7 @@
         byte major = (byte) body.versionMajor;
         byte minor = (byte) body.versionMinor;
 
-        if(checkVersionOK(major, minor))
+        if (checkVersionOK(major, minor))
         {
 
             protocolSession.setProtocolVersion(major, minor);
@@ -169,16 +169,25 @@
 
     private boolean checkVersionOK(byte versionMajor, byte versionMinor)
     {
-        byte[][] supportedVersions = ProtocolVersionList.pv;
-        boolean supported = false;
-        int i = supportedVersions.length;
-        while(i-- != 0 && !supported)
+        // this system property allows the client to accept whatever version 
the broker
+        // offers. Useful only when doing testing.
+        if (Boolean.getBoolean("qpid.accept.broker.version"))
         {
-            supported = 
(supportedVersions[i][ProtocolVersionList.PROTOCOL_MAJOR] == versionMajor)
-                        && 
(supportedVersions[i][ProtocolVersionList.PROTOCOL_MINOR] == versionMinor);
+            return true;
         }
+        else
+        {
+            byte[][] supportedVersions = ProtocolVersionList.pv;
+            boolean supported = false;
+            int i = supportedVersions.length;
+            while(i-- != 0 && !supported)
+            {
+                supported = 
(supportedVersions[i][ProtocolVersionList.PROTOCOL_MAJOR] == versionMajor)
+                            && 
(supportedVersions[i][ProtocolVersionList.PROTOCOL_MINOR] == versionMinor);
+            }
 
-        return supported;
+            return supported;
+        }
     }
 
     private String getFullSystemInfo()


Reply via email to