You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ra...@apache.org on 2015/08/28 22:54:49 UTC

[2/3] qpid-proton git commit: Bug fixes.

Bug fixes.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/374aa9c4
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/374aa9c4
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/374aa9c4

Branch: refs/heads/rajith-codec
Commit: 374aa9c47e694f0d347b8f5df38dfae86e4d7db4
Parents: 8964741
Author: Rajith Attapattu <ra...@apache.org>
Authored: Fri Aug 28 16:53:49 2015 -0400
Committer: Rajith Attapattu <ra...@apache.org>
Committed: Fri Aug 28 16:53:49 2015 -0400

----------------------------------------------------------------------
 .../proton/engine/impl/LegacyTypeHelper.java    | 124 ++++++++++++-------
 .../apache/qpid/proton/transport2/Begin.java    |   2 +-
 .../apache/qpid/proton/transport2/Transfer.java |   9 +-
 3 files changed, 85 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/374aa9c4/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LegacyTypeHelper.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LegacyTypeHelper.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LegacyTypeHelper.java
index 949e0a8..db75f8e 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LegacyTypeHelper.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LegacyTypeHelper.java
@@ -242,65 +242,93 @@ public class LegacyTypeHelper
 
     public static Source convertFromLegacySource(org.apache.qpid.proton.amqp.transport.Source source)
     {
-        org.apache.qpid.proton.amqp.messaging.Source legacy = (org.apache.qpid.proton.amqp.messaging.Source) source;
-        Source s = new Source();
-        s.setAddress(legacy.getAddress());
-        s.setCapabilities(convertToStringArray(legacy.getCapabilities()));
-        // s.setDefaultOutcome(legacy.getDefaultOutcome());
-        s.setDistributionMode(legacy.getDistributionMode() == null ? null : legacy.getDistributionMode().toString());
-        s.setDurable(TerminusDurability.get(legacy.getDurable().getValue().byteValue()));
-        s.setDynamic(legacy.getDynamic());
-        s.setDynamicNodeProperties(legacy.getDynamicNodeProperties());
-        s.setExpiryPolicy(TerminusExpiryPolicy.getEnum(legacy.getExpiryPolicy().getPolicy().toString()));
-        s.setFilter(legacy.getFilter());
-        s.setOutcomes(convertToStringArray(legacy.getOutcomes()));
-        s.setTimeout(legacy.getTimeout().intValue());
-        return s;
+        if (source == null)
+        {
+            return null;
+        }
+        else
+        {
+            org.apache.qpid.proton.amqp.messaging.Source legacy = (org.apache.qpid.proton.amqp.messaging.Source) source;
+            Source s = new Source();
+            s.setAddress(legacy.getAddress());
+            s.setCapabilities(convertToStringArray(legacy.getCapabilities()));
+            // s.setDefaultOutcome(legacy.getDefaultOutcome());
+            s.setDistributionMode(legacy.getDistributionMode() == null ? null : legacy.getDistributionMode().toString());
+            s.setDurable(TerminusDurability.get(legacy.getDurable().getValue().byteValue()));
+            s.setDynamic(legacy.getDynamic());
+            s.setDynamicNodeProperties(legacy.getDynamicNodeProperties());
+            s.setExpiryPolicy(TerminusExpiryPolicy.getEnum(legacy.getExpiryPolicy().getPolicy().toString()));
+            s.setFilter(legacy.getFilter());
+            s.setOutcomes(convertToStringArray(legacy.getOutcomes()));
+            s.setTimeout(legacy.getTimeout().intValue());
+            return s;
+        }
     }
 
     public static Target convertFromLegacyTarget(org.apache.qpid.proton.amqp.transport.Target target)
     {
-        org.apache.qpid.proton.amqp.messaging.Target legacy = (org.apache.qpid.proton.amqp.messaging.Target) target;
-        Target t = new Target();
-        t.setAddress(legacy.getAddress());
-        t.setCapabilities(convertToStringArray(legacy.getCapabilities()));
-
-        t.setDurable(TerminusDurability.get(legacy.getDurable().getValue().byteValue()));
-        t.setDynamic(legacy.getDynamic());
-        t.setDynamicNodeProperties(legacy.getDynamicNodeProperties());
-        t.setExpiryPolicy(TerminusExpiryPolicy.getEnum(legacy.getExpiryPolicy().getPolicy().toString()));
-        t.setTimeout(legacy.getTimeout().intValue());
-        return t;
+        if (target == null)
+        {
+            return null;
+        }
+        else
+        {
+            org.apache.qpid.proton.amqp.messaging.Target legacy = (org.apache.qpid.proton.amqp.messaging.Target) target;
+            Target t = new Target();
+            t.setAddress(legacy.getAddress());
+            t.setCapabilities(convertToStringArray(legacy.getCapabilities()));
+    
+            t.setDurable(TerminusDurability.get(legacy.getDurable().getValue().byteValue()));
+            t.setDynamic(legacy.getDynamic());
+            t.setDynamicNodeProperties(legacy.getDynamicNodeProperties());
+            t.setExpiryPolicy(TerminusExpiryPolicy.getEnum(legacy.getExpiryPolicy().getPolicy().toString()));
+            t.setTimeout(legacy.getTimeout().intValue());
+            return t;
+        }
     }
 
     public static org.apache.qpid.proton.amqp.transport.Source convertToLegacySource(Source s)
     {
-        org.apache.qpid.proton.amqp.messaging.Source legacy = new org.apache.qpid.proton.amqp.messaging.Source();
-        legacy.setAddress(s.getAddress());
-        legacy.setCapabilities(convertToSymbolArray(s.getCapabilities()));
-        // legacy.setDefaultOutcome(s.getDefaultOutcome());
-        legacy.setDistributionMode(s.getDistributionMode() == null ? null : Symbol.valueOf(s.getDistributionMode().toString()));
-        legacy.setDurable(org.apache.qpid.proton.amqp.messaging.TerminusDurability.get(UnsignedInteger.valueOf(s
-                .getDurable().getValue())));
-        legacy.setDynamic(s.getDynamic());
-        legacy.setDynamicNodeProperties(s.getDynamicNodeProperties());
-        legacy.setFilter(s.getFilter());
-        legacy.setOutcomes(convertToSymbolArray(s.getOutcomes()));
-        legacy.setTimeout(UnsignedInteger.valueOf(s.getTimeout()));
-        return legacy;
+        if (s == null)
+        {
+            return null;
+        }
+        else
+        {
+            org.apache.qpid.proton.amqp.messaging.Source legacy = new org.apache.qpid.proton.amqp.messaging.Source();
+            legacy.setAddress(s.getAddress());
+            legacy.setCapabilities(convertToSymbolArray(s.getCapabilities()));
+            // legacy.setDefaultOutcome(s.getDefaultOutcome());
+            legacy.setDistributionMode(s.getDistributionMode() == null ? null : Symbol.valueOf(s.getDistributionMode().toString()));
+            legacy.setDurable(org.apache.qpid.proton.amqp.messaging.TerminusDurability.get(UnsignedInteger.valueOf(s
+                    .getDurable().getValue())));
+            legacy.setDynamic(s.getDynamic());
+            legacy.setDynamicNodeProperties(s.getDynamicNodeProperties());
+            legacy.setFilter(s.getFilter());
+            legacy.setOutcomes(convertToSymbolArray(s.getOutcomes()));
+            legacy.setTimeout(UnsignedInteger.valueOf(s.getTimeout()));
+            return legacy;
+        }
     }
     
     public static org.apache.qpid.proton.amqp.transport.Target convertToLegacyTarget(Target target)
     {
-        org.apache.qpid.proton.amqp.messaging.Target legacy = new org.apache.qpid.proton.amqp.messaging.Target();
-        legacy.setAddress(target.getAddress());
-        legacy.setCapabilities(convertToSymbolArray(target.getCapabilities()));
-
-        legacy.setDurable(org.apache.qpid.proton.amqp.messaging.TerminusDurability.get(UnsignedInteger.valueOf((int)target.getDurable().getValue())));
-        legacy.setDynamic(target.getDynamic());
-        legacy.setDynamicNodeProperties(target.getDynamicNodeProperties());
-        legacy.setExpiryPolicy(org.apache.qpid.proton.amqp.messaging.TerminusExpiryPolicy.valueOf(target.getExpiryPolicy().toString()));
-        legacy.setTimeout(UnsignedInteger.valueOf(target.getTimeout()));
-        return legacy;
+        if (target == null)
+        {
+            return null;
+        }
+        else
+        {
+            org.apache.qpid.proton.amqp.messaging.Target legacy = new org.apache.qpid.proton.amqp.messaging.Target();
+            legacy.setAddress(target.getAddress());
+            legacy.setCapabilities(convertToSymbolArray(target.getCapabilities()));
+    
+            legacy.setDurable(org.apache.qpid.proton.amqp.messaging.TerminusDurability.get(UnsignedInteger.valueOf((int)target.getDurable().getValue())));
+            legacy.setDynamic(target.getDynamic());
+            legacy.setDynamicNodeProperties(target.getDynamicNodeProperties());
+            legacy.setExpiryPolicy(org.apache.qpid.proton.amqp.messaging.TerminusExpiryPolicy.valueOf(target.getExpiryPolicy().toString()));
+            legacy.setTimeout(UnsignedInteger.valueOf(target.getTimeout()));
+            return legacy;
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/374aa9c4/proton-j/src/main/java/org/apache/qpid/proton/transport2/Begin.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/transport2/Begin.java b/proton-j/src/main/java/org/apache/qpid/proton/transport2/Begin.java
index 63218d7..f8d3a1c 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/transport2/Begin.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/transport2/Begin.java
@@ -194,7 +194,7 @@ public final class Begin implements Encodable, Performative
             case 6:
                 begin.setNextOutgoingId(l.get(1) == null ? 0 : (Integer) l.get(1));
             case 7:
-                begin.setRemoteChannel(l.get(0) == null ? -1 : (Integer) l.get(0));
+                begin.setRemoteChannel(l.get(0) == null ? -1 : ((Short)l.get(0)).intValue());
             }
 
             return begin;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/374aa9c4/proton-j/src/main/java/org/apache/qpid/proton/transport2/Transfer.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/transport2/Transfer.java b/proton-j/src/main/java/org/apache/qpid/proton/transport2/Transfer.java
index aad782e..82e71de 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/transport2/Transfer.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/transport2/Transfer.java
@@ -180,7 +180,14 @@ public final class Transfer implements Encodable, Performative
         encoder.putUint(_messageFormat);
         encoder.putBoolean(_settled);
         encoder.putBoolean(_more);
-        encoder.putUbyte(_rcvSettleMode.getValue());
+        if (_rcvSettleMode == null)
+        {
+            encoder.putNull();
+        }
+        else
+        {
+            encoder.putUbyte(_rcvSettleMode.getValue());
+        }
         if (_state == null)
         {
             encoder.putNull();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org