camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-9127: SmppConsumer throws IllegalArgumentException if the delivery receipt contains vendor specific optional parameters. Thanks to Anshu Avinash for the patch.
Date Fri, 11 Sep 2015 08:55:49 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.15.x b90540859 -> 4c9865a39
  refs/heads/master 7ac77fe38 -> 05272a56f


CAMEL-9127: SmppConsumer throws IllegalArgumentException if the delivery receipt contains
vendor specific optional parameters. Thanks to Anshu Avinash for the patch.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/05272a56
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/05272a56
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/05272a56

Branch: refs/heads/master
Commit: 05272a56fd4a96ac57b6455eb01a723f0e33c7d3
Parents: 7ac77fe
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Sep 11 10:55:57 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Sep 11 10:55:57 2015 +0200

----------------------------------------------------------------------
 .../camel/component/smpp/SmppBinding.java       | 35 ++++++++++++--------
 1 file changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/05272a56/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppBinding.java
b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppBinding.java
index e93dbe4..b44658f 100644
--- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppBinding.java
+++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppBinding.java
@@ -35,6 +35,9 @@ import org.jsmpp.bean.OptionalParameter.COctetString;
 import org.jsmpp.bean.OptionalParameter.Null;
 import org.jsmpp.bean.OptionalParameter.OctetString;
 import org.jsmpp.session.SMPPSession;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 
 /**
  * A Strategy used to convert between a Camel {@link Exchange} and
@@ -44,6 +47,8 @@ import org.jsmpp.session.SMPPSession;
  */
 public class SmppBinding {
 
+    private static final Logger LOG = LoggerFactory.getLogger(SmppBinding.class);
+
     private SmppConfiguration configuration;
 
     public SmppBinding() {
@@ -158,18 +163,22 @@ public class SmppBinding {
 
         Map<String, Object> optParams = new HashMap<String, Object>();
         for (OptionalParameter optPara : oplist) {
-            if (COctetString.class.isInstance(optPara)) {
-                optParams.put(OptionalParameter.Tag.valueOf(optPara.tag).toString(), ((COctetString)
optPara).getValueAsString());
-            } else if (org.jsmpp.bean.OptionalParameter.OctetString.class.isInstance(optPara))
{
-                optParams.put(OptionalParameter.Tag.valueOf(optPara.tag).toString(), ((OctetString)
optPara).getValueAsString());
-            } else if (org.jsmpp.bean.OptionalParameter.Byte.class.isInstance(optPara)) {
-                optParams.put(OptionalParameter.Tag.valueOf(optPara.tag).toString(), Byte.valueOf(((org.jsmpp.bean.OptionalParameter.Byte)
optPara).getValue()));
-            } else if (org.jsmpp.bean.OptionalParameter.Short.class.isInstance(optPara))
{
-                optParams.put(OptionalParameter.Tag.valueOf(optPara.tag).toString(), Short.valueOf(((org.jsmpp.bean.OptionalParameter.Short)
optPara).getValue()));
-            } else if (org.jsmpp.bean.OptionalParameter.Int.class.isInstance(optPara)) {
-                optParams.put(OptionalParameter.Tag.valueOf(optPara.tag).toString(), Integer.valueOf(((org.jsmpp.bean.OptionalParameter.Int)
optPara).getValue()));
-            } else if (Null.class.isInstance(optPara)) {
-                optParams.put(OptionalParameter.Tag.valueOf(optPara.tag).toString(), null);
+            try {
+                if (COctetString.class.isInstance(optPara)) {
+                    optParams.put(OptionalParameter.Tag.valueOf(optPara.tag).toString(),
((COctetString) optPara).getValueAsString());
+                } else if (org.jsmpp.bean.OptionalParameter.OctetString.class.isInstance(optPara))
{
+                    optParams.put(OptionalParameter.Tag.valueOf(optPara.tag).toString(),
((OctetString) optPara).getValueAsString());
+                } else if (org.jsmpp.bean.OptionalParameter.Byte.class.isInstance(optPara))
{
+                    optParams.put(OptionalParameter.Tag.valueOf(optPara.tag).toString(),
Byte.valueOf(((org.jsmpp.bean.OptionalParameter.Byte) optPara).getValue()));
+                } else if (org.jsmpp.bean.OptionalParameter.Short.class.isInstance(optPara))
{
+                    optParams.put(OptionalParameter.Tag.valueOf(optPara.tag).toString(),
Short.valueOf(((org.jsmpp.bean.OptionalParameter.Short) optPara).getValue()));
+                } else if (org.jsmpp.bean.OptionalParameter.Int.class.isInstance(optPara))
{
+                    optParams.put(OptionalParameter.Tag.valueOf(optPara.tag).toString(),
Integer.valueOf(((org.jsmpp.bean.OptionalParameter.Int) optPara).getValue()));
+                } else if (Null.class.isInstance(optPara)) {
+                    optParams.put(OptionalParameter.Tag.valueOf(optPara.tag).toString(),
null);
+                }
+            } catch (IllegalArgumentException e) {
+                LOG.debug("Skipping optional parameter with tag {} due " + e.getMessage(),
optPara.tag);
             }
         }
 
@@ -246,4 +255,4 @@ public class SmppBinding {
     public void setConfiguration(SmppConfiguration configuration) {
         this.configuration = configuration;
     }
-}
\ No newline at end of file
+}


Mime
View raw message